提取 ShadowSsdt 原始地址代码
comment/*
BOOLEAN KeAddSystemServiceTable(
IN PVOID ServiceTableBase,
IN PVOID ServiceCounterTableBase,
IN ULONG NumberOfService,
IN PVOID ParamTableBase,
IN ULONG InsertServiceTableIndex
)
$-18 > 57 push edi
$-17 > 68 10E399BF push BF99E310
$-12 > FF35 0CE399BF push dword ptr [BF99E30C]
$-C > 8935 30899ABF mov dword ptr [BF9A8930],esi
$-6 > 56 push esi
$-5 > 68 00D699BF push BF99D600
$ ==> > FF15 580799BF call dword ptr [BF990758]
INIT:BF9B3B22 push edi InsertServiceTableIndex
INIT:BF9B3B23 push offset unk_BF99E310 ParamTableBase
INIT:BF9B3B28 push dword_BF99E30C NumberOfService
INIT:BF9B3B2E mov dword_BF9A8930, esi
INIT:BF9B3B34 push esi ServiceCounterTableBase
INIT:BF9B3B35 push offset off_BF99D600 ServiceTableBase
INIT:BF9B3B3A call ds:KeAddSystemServiceTable
*/
........................映射代码忽略
assume edi:nothing
mov edi, BaseAddress
add edi, [edi].IMAGE_DOS_HEADER.e_lfanew
movzx eax, [edi].IMAGE_NT_HEADERS.FileHeader.NumberOfSections
mov Indent, eax
add edi, sizeof IMAGE_NT_HEADERS
assume edi:ptr IMAGE_SECTION_HEADER
mov VirtualSize, 0
.repeat
invoke StrCmp,edi,T("INIT")
.if eax
m2m VirtualSize, [edi].Misc.VirtualSize
mov edi, [edi].PointerToRawData
add edi, BaseAddress
.break
.endif
add edi, sizeof IMAGE_SECTION_HEADER
dec Indent
.until Indent == 0
cmp VirtualSize, 0
je err
mov Call_KeAddSystemServiceTable, 0
mov Indent, 0
.while TRUE
invoke DisasmLen,edi,addr hde
.if hde.len == 6 && hde.opcode == 0FFh && hde.modrm == 15h && hde.disp32
mov eax, hde.disp32
sub eax, [esi].OptionalHeader.ImageBase
invoke RVAToFileMap,BaseAddress,eax
.if eax == Import_KeAddSystemServiceTable
mov Call_KeAddSystemServiceTable, edi
.break
.endif
.endif
mov eax, hde.len
add edi, eax
add Indent, eax
mov eax, Indent
.break .if eax >= VirtualSize
.endw
cmp Call_KeAddSystemServiceTable, 0
jz err
m2m ImageBase, [esi].OptionalHeader.ImageBase
mov edi, Call_KeAddSystemServiceTable
mov eax, DWORD ptr[edi-5+1]
sub eax, [esi].OptionalHeader.ImageBase
add eax, BaseAddress
mov Shadow_ServiceTableBase, eax
mov eax, DWORD ptr[edi-17h+1]
sub eax, [esi].OptionalHeader.ImageBase
add eax, BaseAddress
mov Shadow_ParamTableBase, eax
mov eax, DWORD ptr[edi-12h+2]
sub eax, [esi].OptionalHeader.ImageBase
add eax, BaseAddress
m2m Shadow_NumberOfService, DWORD ptr[eax]
.................................以下代码忽略
运行效果
