能力值:
( LV2,RANK:10 )
|
-
-
3 楼
TimePort是干什么的?我怎么在360目录下没搜索到呢?和port相关的有个HookPort,用来挂钩SSDT的。源代码肯定没有吧!有也不会放出来呀。自己逆向才是王道。
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
HOOK ZwSetSystemTime
|
能力值:
(RANK:400 )
|
-
-
6 楼
核心代码就是SSDT HOOK NtSetSystemTime,最后处理就很简单了。MJ n年前的作品了。
|
能力值:
( LV8,RANK:120 )
|
-
-
7 楼
SSDT HOOK NtSetSystemTime就OK了哦·!
.386
.model flat,stdcall
option casemap:none
include systest.inc
_NTSetSystemTime typedef proto :PLARGE_INTEGER,:PLARGE_INTEGER
NTSetSystemTime typedef ptr _NTSetSystemTime
.data
oldNtFunAddr NTSetSystemTime NULL ;旧函数地址
oldNtFunSrvID dd 0 ;旧NT函数服务号
tmpBuf db 512 dup(NULL)
zwFunctionName UNICODE_STRING <> ;被HOOK函数名
.code
MyZwSetSystemTime proc newTime:PLARGE_INTEGER,oldTime:PLARGE_INTEGER
invoke DbgPrint,$CTA0("Reject Update Local Time\n")
mov eax,STATUS_UNSUCCESSFUL
ret
MyZwSetSystemTime endp
UnHook proc oldFunctionAddress:dword,oldFunctionPoint:dword ;卸载HOOK
pushad
invoke DbgPrint,$CTA0("UnHook \n")
call WPOFF
mov esi,oldFunctionAddress
mov eax,oldFunctionPoint
mov dword ptr[esi],eax ;还原旧的函数地址
call WPON
popad
ret
UnHook endp
SetHook proc NtServerID:dword,NewFunAddr:dword ;设置HOOK
LOCAL oldAddr:dword
invoke DbgPrint,$CTA0("SetHook \n")
mov esi,NtServerID
mov edi,dword ptr[esi]
mov oldAddr,edi ;保存旧函数地址
mov edi,NewFunAddr ;自己的函数偏移
call WPOFF
mov dword ptr[esi],edi ;替换成我们自己的函数
call WPON
mov eax,oldAddr
ret
SetHook endp
GetZwFunctionAddr proc uniZwFunName:PUNICODE_STRING ;获取ZW系列导出函数地址
LOCAL funAddr:dword
call WPOFF
invoke MmGetSystemRoutineAddress,uniZwFunName ;$CCOUNTED_UNICODE_STRING("ZwSetSystemTime")
mov funAddr,eax
call WPON
mov eax,funAddr
ret
GetZwFunctionAddr endp
GetNtFunctionServerID proc uniZwFunName:PUNICODE_STRING ;获取ZW对应的NT函数服务号
mov eax,KeServiceDescriptorTable ;获取KeServiceDescriptorTable的地址
mov esi,[eax]
mov esi,[esi] ;获取KeServiceDescriptorTable->ServiceTableBase
invoke GetZwFunctionAddr,uniZwFunName ;获取被HOOK函数的地址
inc eax
movzx ecx,byte ptr[eax] ;取被HOOK函数服务号
sal ecx,2
add esi,ecx
mov eax,esi
ret
GetNtFunctionServerID endp
WPOFF proc ;关闭内存保护
cli
mov eax,cr0
xor eax,10000h
mov cr0,eax
ret
WPOFF endp
WPON proc ;开启内存保护
mov eax, cr0
xor eax,10000h
mov cr0, eax
sti
ret
WPON endp
DriverUnload proc pDriverObject:PDRIVER_OBJECT
invoke DbgPrint,$CTA0("Driver UnLoad \n")
invoke UnHook,oldNtFunSrvID,oldNtFunAddr
ret
DriverUnload endp
DriverEntry proc pDriverObject:PDRIVER_OBJECT,pRegistryPath:PUNICODE_STRING
pushad
invoke DbgPrint,$CTA0("Load Driver Success\n")
invoke RtlInitUnicodeString,addr zwFunctionName,$CTW0("ZwSetSystemTime")
invoke GetNtFunctionServerID,addr zwFunctionName
mov oldNtFunSrvID,eax
invoke SetHook,oldNtFunSrvID,offset MyZwSetSystemTime
mov oldNtFunAddr,eax
invoke DbgPrint,$CTA0("Old NtFunction Address: 0x%08X \n"),oldNtFunAddr
invoke DbgPrint,$CTA0("MyZwFunction Address: 0x%08X \n"),offset MyZwSetSystemTime ;输出自己的函数偏移
mov esi,pDriverObject
mov [esi+34h],offset DriverUnload ;设置卸载例程
popad
mov eax,STATUS_SUCCESS
ret
DriverEntry endp
end DriverEntry
|