Quantcast
Channel: 看雪安全论坛
Viewing all articles
Browse latest Browse all 9556

系统底层 【原创】pspcidtable之旅 (win8.1 x86)

$
0
0
1. 获取pspcidtable的地址

lkd> dd pspcidtable
812a0314 82006000 00000002 00000200 0000000f
812a0324 0000001e 00000258 00000000 00000000
812a0334 812a0324 8108e4cc 0000001e 812a0320
812a0344 8108e4fc 0000000f 812a0328 8108e528
812a0354 00000258 812a031c 8108e558 00000200
812a0364 8486f520 84873040 8486bb38 00000000
812a0374 ffffffff 00000000 00000000 00000002
812a0384 00000000 00000005 c0000044 00000005

2. pspcidtable 地址为82006000, 是指向一个 _handle_table

lkd> dt _handle_table 82006000
ntdll!_HANDLE_TABLE
+0x000 NextHandleNeedingPool : 0x1000
+0x004 ExtraInfoPages : 0n0
+0x008 TableCode : 0x80901001
+0x00c QuotaProcess : (null)
+0x010 HandleTableList : _LIST_ENTRY [ 0x82006010 - 0x82006010 ]
+0x018 UniqueProcessId : 0
+0x01c Flags : 1
+0x01c StrictFIFO : 0y1
+0x01c EnableHandleExceptions : 0y0
+0x01c Rundown : 0y0
+0x01c Duplicated : 0y0
+0x020 HandleContentionEvent : _EX_PUSH_LOCK
+0x024 HandleTableLock : _EX_PUSH_LOCK
+0x028 FreeLists : [1] _HANDLE_TABLE_FREE_LIST
+0x028 ActualEntry : [20] ""
+0x03c DebugInfo : (null)

3. 其中的TableCode为0x80901001, TableCode 字段的解释与其他系统中一样的,低 3 Bits 表示是几层表结构,低3位清0之后的值就是层表地址。
0x80901001 低3位清零后为 0x80901000 ,是一个二级表

lkd> dd 0x80901000
80901000 82008000 80903000 00000000 00000000
80901010 00000000 00000000 00000000 00000000
80901020 00000000 00000000 00000000 00000000
80901030 00000000 00000000 00000000 00000000
80901040 00000000 00000000 00000000 00000000
80901050 00000000 00000000 00000000 00000000
80901060 00000000 00000000 00000000 00000000
80901070 00000000 00000000 00000000 00000000

4. 二级表是包含指向一级表的指针,发掘第一个一级表82008000

lkd> dd 82008000
82008000 00000000 00000000 8486e441 98000000
82008010 84875bc1 00000000 84875741 00000000
82008020 8487e041 00000000 8487e8c1 00000000
82008030 84880bc1 00000000 84880741 00000000
82008040 8487b041 00000000 00000000 809032a8
82008050 8487b4c1 00000000 848a5a41 00000000
82008060 848a55c1 00000000 848825c1 00000000
82008070 848329c1 00000000 84832581 00000000

5. 一级表是_HANDLE_TABLE_ENTRY数组,第一个为0,我们看看第二个

lkd> dt _handle_table_entry 8486e441
ntdll!_HANDLE_TABLE_ENTRY
+0x000 VolatileLowValue : 0n10240
+0x000 LowValue : 0n10240
+0x000 InfoTable : 0x00002800 _HANDLE_TABLE_ENTRY_INFO
+0x000 Unlocked : 0y0
+0x000 Attributes : 0y00
+0x000 ObjectPointerBits : 0y00000000000000000010100000000 (0x500)
+0x004 HighValue : 0n1207959552
+0x004 NextFreeHandleEntry : 0x48000000 _HANDLE_TABLE_ENTRY
+0x004 LeafHandleValue : _EXHANDLE
+0x004 GrantedAccessBits : 0y0000000000000000000000000 (0)
+0x004 ProtectFromClose : 0y0
+0x004 NoRightsUpgrade : 0y0
+0x004 RefCnt : 0y01001 (0x9)

6. 计算出object 的地址为: 8486e440
Object Address = (Object/ObjectPointerBits & 0xFFFFFFF8) | 0x80000000

lkd> !object 8486e440
Object: 8486e440 Type: (8486bf70) Process
ObjectHeader: 8486e428 (new version)
HandleCount: 5 PointerCount: 305

lkd> dt _eprocess 8486e440
ntdll!_EPROCESS
+0x000 Pcb : _KPROCESS
+0x0a0 ProcessLock : _EX_PUSH_LOCK
+0x0a8 CreateTime : _LARGE_INTEGER 0x01ceec99`1748a0c8
+0x0b0 RundownProtect : _EX_RUNDOWN_REF
+0x0b4 UniqueProcessId : 0x00000004 Void
....
+0x170 ImageFileName : [15] "System"
....

原来是 System 进程, PID 为 4

参考:
http://bbs.pediy.com/showthread.php?t=170205
http://hi.baidu.com/_achillis/item/d76dd19faa660e8d5914611a

Viewing all articles
Browse latest Browse all 9556


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>