InLineHookSSDT

//当Ring3调用OpenProcess 

//1从自己的模块(.exe)的导入表中取值

//2Ntdll.dll模块的导出表中执行ZwOpenProcess(取索引 进入Ring0层)

//3进入Ring0 从Ntoskernel.exe模块的导出表中执行ZwOpenProcess(取索引 获得SSDT服务地址)

//4通过索引在SSDT表中取值(NtOpenProcess的地址)  

//5真正调用NtOpenProcess函数

在真正调用OpenProcess后 可以通过修改里面跳转函数的地址 从而HookSSDT

 1     /*
 2     kd> u NtOpenProcess
 3     nt!NtOpenProcess:
 4     fffff800`0415d2ec 4883ec38        sub     rsp,38h
 5     fffff800`0415d2f0 65488b042588010000 mov   rax,qword ptr gs:[188h]
 6     fffff800`0415d2f9 448a90f6010000  mov     r10b,byte ptr [rax+1F6h]
 7     fffff800`0415d300 4488542428      mov     byte ptr [rsp+28h],r10b
 8     fffff800`0415d305 4488542420      mov     byte ptr [rsp+20h],r10b
 9     fffff800`0415d30a e851fcffff      call    nt!PsOpenProcess (fffff800`0415cf60)
10     fffff800`0415d30f 4883c438        add     rsp,38h
11     fffff800`0415d313 c3              ret
12     */
win7_64中OpenProcess
 1 /*
 2 u ZwOpenProcess
 3 nt!ZwOpenProcess:
 4 805016b4 b87a000000      mov     eax,7Ah
 5 805016b9 8d542404        lea     edx,[esp+4]
 6 805016bd 9c              pushfd
 7 805016be 6a08            push    8
 8 805016c0 e88c0d0400      call    nt!KiSystemService (80542451)
 9 805016c5 c21000          ret     10h
10 nt!ZwOpenProcessToken:
11 805016c8 b87b000000      mov     eax,7Bh
12 805016cd 8d542404        lea     edx,[esp+4]
13     
14 */
WinXP中OpenProcess

首先获得SSDT的地址 

在SSDT中查找OpenProcess的Index

保存原来函数地址 (在卸载驱动时要恢复回去);

修改ZwOpenProcess中的跳转函数

http://www.cnblogs.com/yifi/p/4968755.html

爱程序 不爱bug 爱生活 不爱黑眼圈 我和你们一样 我和你们不一样 我不是凡客 我要做geek
原文地址:https://www.cnblogs.com/yifi/p/4968758.html