首页
社区
课程
招聘
[旧帖] 帮我看下这个SSDT HOOK哪里错了 谢谢 0.00雪花
发表于: 2009-5-25 11:23 4199

[旧帖] 帮我看下这个SSDT HOOK哪里错了 谢谢 0.00雪花

2009-5-25 11:23
4199
帮我看下这个SSDT HOOK哪里错了 谢谢
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
.386
    .model flat, stdcall
    option casemap:none
     
_PROCVAR typedef proto :DWORD,:DWORD,:DWORD,:DWORD
PROCVAR  typedef  ptr _PROCVAR
 
include w2k\ntstatus.inc
include w2k\ntddk.inc
include w2k\ntoskrnl.inc
include w2k\w2kundoc.inc
includelib C:\MASMPlus\Lib\w2k\ntoskrnl.lib
include Strings.mac
 
  SYSTEMTHREADS struct
    KernelTime           db      8 dup(?)
    UserTime             db      8 dup(?)
    CreateTime           db      8 dup(?)
    WaitTime             ULONG   ?               
    StartAddress         PVOID   ?             
    ClientIs             dd      ?
    Priority             dd      ?
    BasePriority         dd      ?
    ContextSwitchCount   ULONG   ?              
    ThreadState          ULONG   ?
    WaitReason           dd      ?     
  SYSTEMTHREADS ends
 
  SYSTEMPROCESSES struct
    NextEntryDelta           ULONG              ?
    ThreadCount              ULONG              ?
    Reserved1                dd                 6 DUP(?)
    CreateTime               db                 8 dup(?)
    UserTime                 db                 8 dup(?)
    KernelTime               db                 8 dup(?)
    ProcessName              UNICODE_STRING     <>  
    BasePriority             dd                 ?           
    ProcessId                ULONG              ?             
    InheritedFromProcessId   ULONG              ?
    HandleCount              ULONG              ?
    Reserved2                ULONG              2 DUP(?)
    VmCounters               dd                 ?
    IoCounters               dd                 ?
    Threads  SYSTEMTHREADS   <>
  SYSTEMPROCESSES ends
 
    .data
realaddr PROCVAR 0
CR0Reg dd 0
Messaga2 db "Çý¶¯¼ÓÔØ", 0
xuliehao dd 0
 
     .const
CCOUNTED_UNICODE_STRING "ZwQuerySystemInformation", g_ApiAddr, 4
    .code
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NewZwQuerySystemInformation proc SystemInformationClass:ULONG,SystemInformation:PVOID,SystemInformationLength:ULONG,ReturnLength:PULONG
    invoke NtQuerySystemInformation ,SystemInformationClass,SystemInformation,SystemInformationLength,ReturnLength
    .if eax
        .if SystemInformationClass==5
            mov edi,DWORD ptr SystemInformation
            assume edi:PTR SYSTEMPROCESSES
            push eax
            .while [edi].NextEntryDelta!=0
                invoke DbgPrint,$CTA0("ID=%d ProcessName=%ws\n"),[edi].ProcessId,[edi].ProcessName.Buffer
                add edi,[edi].NextEntryDelta
            .endw
            pop eax
            assume edi:nothing
        .endif
    .endif
    ret
NewZwQuerySystemInformation endp
 
DriverEntry proc pDriverObject:PDRIVER_OBJECT, pusRegistryPath:PUNICODE_STRING
local pDeviceObject:PVOID
    pushad
    invoke DbgPrint, addr Messaga2
    invoke MmGetSystemRoutineAddress,addr g_ApiAddr
    mov eax, [eax+1]
    mov xuliehao,eax
    mov edi, DWORD ptr KeServiceDescriptorTable
    mov edi, [edi]
    mov eax,xuliehao
    mov eax, [edi+(eax*4)] ;-
    mov realaddr, eax
    cli
    mov eax, CR0
    mov CR0Reg, eax
    and eax,0fffeffffh
    mov cr0, eax
    mov eax,xuliehao
    mov [edi+(eax*4)], DWORD ptr offset NewZwQuerySystemInformation
    mov eax, CR0Reg
    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
;:::::::::::::::::::::::::::::::::::::::::::::::::::::
DriverUnload proc pDriverObject:PDRIVER_OBJECT
    pushad
    mov edi, DWORD ptr KeServiceDescriptorTable
    mov edi, [edi]
    cli
    mov eax, CR0
    mov CR0Reg, eax
    and eax,0fffeffffh
    mov cr0, eax
    mov eax,xuliehao
    mov ecx, DWORD ptr realaddr
    mov [edi+(eax*4)], ecx
    mov eax, CR0Reg
    mov CR0, eax
    sti
    popad
    ret
DriverUnload endp
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end DriverEntry


好象是NewZwQuerySystemInformation的问题 但是不知道怎么改

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费
支持
分享
最新回复 (13)
雪    币: 238
活跃值: (78)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
顶 HOOK应该没问题      大家帮帮小弟啊 我还是搞不定啊
2009-5-25 15:12
0
雪    币: 238
活跃值: (78)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
没人帮我么 UPUP
2009-5-25 20:52
0
雪    币: 419
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
既然 HOOK 没有问题

那究竟还有什么问题?
2009-5-25 22:46
0
雪    币: 238
活跃值: (78)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
就是找不到问题啊 第一次写驱动
2009-5-25 22:51
0
雪    币: 419
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
是蓝了,还是不起作用,达不到你的目的

也应该说得明白点吧
2009-5-25 22:52
0
雪    币: 238
活跃值: (78)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
是蓝了啊 呵呵
invoke DbgPrint,$CTA0("ID=%d ProcessName=%ws\n"),[edi].ProcessId,[edi].ProcessName.Buffer
把这句注释掉 就不会蓝
2009-5-25 23:04
0
雪    币: 210
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
问下,这是什么程序啊?哪本书上有介绍?
2009-5-25 23:27
0
雪    币: 419
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
从蓝的地址来看,这段有问题      
.while [edi].NextEntryDelta!=0
          invoke DbgPrint,$CTA0("ID=%d ProcessName=%ws\n"),[edi].ProcessId,[edi].ProcessName.Buffer
          add edi,[edi].NextEntryDelta
        .endw
2009-5-25 23:39
0
雪    币: 419
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
.text:000102A1                 push    eax
.text:000102A2                 jmp     short loc_102B9
.text:000102A2
.text:000102A4 ; ---------------------------------------------------------------------------
.text:000102A4
.text:000102A4 loc_102A4:                              ; CODE XREF: sub_10280+3Cj
.text:000102A4                 push    dword ptr [edi+3Ch]
.text:000102A7                 push    dword ptr [edi+44h]
.text:000102AA                 push    offset Format   ; "ID=%d ProcessName=%ws\r\n"
.text:000102AF                 call    DbgPrint
.text:000102AF
.text:000102B4                 add     esp, 0Ch
.text:000102B7                 add     edi, [edi]
.text:000102B7
.text:000102B9
.text:000102B9 loc_102B9:                              ; CODE XREF: sub_10280+22j
.text:000102B9                 cmp     dword ptr [edi], 0 // 蓝屏地址// edi是一个空指针造成的??
.text:000102BC                 jnz     short loc_102A4
.text:000102BC
.text:000102BE                 pop     eax
2009-5-25 23:40
0
雪    币: 419
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
[QUOTE=xuehaonan;630912]是蓝了啊 呵呵
invoke DbgPrint,$CTA0("ID=%d ProcessName=%ws\n"),[edi].ProcessId,[edi].ProcessName.Buffer
把这句注释掉 就不会蓝[/QUOTE]

那这样处理看看

pushad
invoke DbgPrint,$CTA0("ID=%d ProcessName=%ws\n"),[edi].ProcessId,[edi].ProcessName.Buffer
popad
2009-5-25 23:42
0
雪    币: 419
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
12
用 ASM 写的驱动

看雪论坛就是一本好书
2009-5-25 23:44
0
雪    币: 210
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
13
用没有具体的书?
看雪论坛就是一本好书 ,这话说的太有意境了,但是没啥用。给个链接也行
2009-5-27 11:38
0
雪    币: 419
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
14
http://bbs.pediy.com/showthread.php?t=56817

kmdkit 1.8 这是asm驱动开发包,里面带有大量的例子

google 之
2009-5-27 13:50
0
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册