首页
社区
课程
招聘
inline hook疑问
发表于: 2010-12-16 22:55 4623

inline hook疑问

2010-12-16 22:55
4623
源代码如下:
MyNtGetContextThread proc ThreadHandle,ThreadContext
ret
MyNtGetContextThread endp
OldNtGetContextThread proc ThreadHandle,ThreadContext
        nop
        nop
        mov eax,NtGetContextThread_Addr
        add eax,5
        jmp eax

OldNtGetContextThread endp
DriverEntry proc pDriverObject:PDRIVER_OBJECT,pRegistryPath:PUNICODE_STRING

        pushad
        cli
        mov eax, cr0
        and eax,0fffeffffh
        mov cr0, eax
        
        invoke KeRaiseIrqlToDpcLevel
        mov oldIrql,eax
        
invoke MmGetSystemRoutineAddress,$CCOUNTED_UNICODE_STRING("NtGetContextThread")
        
        mov NtGetContextThread_Addr,eax
        mov ecx,5
        mov esi,eax
        mov edi,offset OldNtGetContextThread
        rep movsb
        mov edx,offset MyNtGetContextThread
        sub edx,eax
        sub edx,5
        mov byte ptr [eax],0e9h
        xchg [eax+1],edx
        
        invoke KeLowerIrql,oldIrql
        
        mov eax, cr0
        or eax,10000h
        mov cr0, eax
        sti
        
        mov eax,pDriverObject
        assume eax:ptr DRIVER_OBJECT
        mov [eax].DriverUnload,offset DriverUnload
        assume eax:nothing

        popad
        mov eax,STATUS_SUCCESS
        ret

DriverEntry endp

end DriverEntry
我想知道为什么蓝

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (5)
雪    币: 3836
活跃值: (4142)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
没提升Irql????
2010-12-16 23:25
0
雪    币: 102
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
mov NtGetContextThread_Addr,eax
        mov ecx,5
        mov esi,eax
        mov edi,offset OldNtGetContextThread
        rep movsb
复制5个字节..
OldNtGetContextThread proc ThreadHandle,ThreadContext
        nop
        nop

但这只有两个字节..

lz,可以测试下..
2010-12-16 23:44
0
雪    币: 96
活跃值: (216)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
还是蓝
2010-12-16 23:51
0
雪    币: 10
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
NtGetContextThread没导出,MmGetSystemRoutineAddress获取不到函数地址的
2010-12-19 21:46
0
雪    币: 26
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
这个我也不知道
2010-12-26 09:02
0
游客
登录 | 注册 方可回帖
返回
//