关于内核NtDeleteFile勾住却没有调用的问题
最近在学习内核相关知识,想尝试利用SSDTHOOK一下系统函数,废话不多说,直接上代码//SSDT相关全局变量
ULONG g_NtDeleteFileAdd = 0;
BOOLEAN g_SSDTOPEN = FALSE;
typedef NTSTATUS(*OriDeleteFileFun)(__in POBJECT_ATTRIBUTES ObjectAttributes);
NTSTATUS MyNtDeleteFile(__in POBJECT_ATTRIBUTES ObjectAttributes) {
DbgBreakPoint();
OriDeleteFileFun OriDeleteFile = (OriDeleteFileFun)g_NtDeleteFileAdd;
return OriDeleteFile(ObjectAttributes);
}
VOID OpenSSDTHook() {
//如果已经开启则退出
if (g_SSDTOPEN) {
return;
}
//记录SSDT表中102号位置的地址
PULONG pSSDT_Base = KeServiceDescriptorTable.ServiceTableBase;
g_NtDeleteFileAdd = (ULONG)pSSDT_Base;
//替换
__asm{
push eax
mov eax,cr0
and eax,~0x10000
mov cr0,eax
pop eax
}
pSSDT_Base = MyNtDeleteFile;
__asm {
push eax
mov eax,cr0
or eax,0x10000
mov cr0,eax
pop eax
}
g_SSDTOPEN = TRUE;
DbgBreakPoint();
}
这些完成后,在pchunter中是这样的,如图
这是勾住了之后,我此时是双机调试状态,我在MyNtDeleteFile中下了一个断点,按照预期应该是删除文件就会在WINDBG中断下,可是并没有,特来向各位前辈请教
页:
[1]