-
-
[求助]2k下修改只读内存释放pages蓝屏
-
发表于: 2009-1-14 11:27 4435
-
我在2k下进行Shadow SSDT Hook
代码大致如下
.............
g_pMdlSystemCall = IoAllocateMdl(
KeServiceDescriptorTableShadow->win32k.ServiceTable,
KeServiceDescriptorTableShadow->win32k.ServiceLimit*4,
FALSE, //not associated with an IRP
FALSE, //charge quota, should be FALSE
NULL); //IRP * should be NULL
if(!g_pMdlSystemCall)
return STATUS_UNSUCCESSFUL;
MmBuildMdlForNonPagedPool(g_pMdlSystemCall);
//g_pMdlSystemCall->MdlFlags = g_pMdlSystemCall->MdlFlags|MDL_MAPPED_TO_SYSTEM_VA;
MmProbeAndLockPages(g_pMdlSystemCall, KernelMode, IoModifyAccess);
MappedSystemCallTable = MmMapLockedPages(g_pMdlSystemCall, KernelMode);
if( ( KeServiceDescriptorTableShadow != NULL && NULL != OrgNtGdiBitBlt))
{
//hook shadow system calls and save old system call locations
UNHOOK_SYSCALL( NtGdiBitBltIndex, OrgNtGdiBitBlt, HookNtGdiBitBlt );
}
else{
KeServiceDescriptorTableShadow = NULL;
}
MmUnmapLockedPages(MappedSystemCallTable, g_pMdlSystemCall);
MmUnlockPages(g_pMdlSystemCall);
IoFreeMdl(g_pMdlSystemCall);
......
这段代码在xp下运行正常,但是在2k下面运行之后Shadow SSDT所在的内存被解除影射了,导致所在的进程访问无效内存--蓝屏
如果去掉MmUnmapLockedPages MmUnlockPages就是正常的
代码大致如下
.............
g_pMdlSystemCall = IoAllocateMdl(
KeServiceDescriptorTableShadow->win32k.ServiceTable,
KeServiceDescriptorTableShadow->win32k.ServiceLimit*4,
FALSE, //not associated with an IRP
FALSE, //charge quota, should be FALSE
NULL); //IRP * should be NULL
if(!g_pMdlSystemCall)
return STATUS_UNSUCCESSFUL;
MmBuildMdlForNonPagedPool(g_pMdlSystemCall);
//g_pMdlSystemCall->MdlFlags = g_pMdlSystemCall->MdlFlags|MDL_MAPPED_TO_SYSTEM_VA;
MmProbeAndLockPages(g_pMdlSystemCall, KernelMode, IoModifyAccess);
MappedSystemCallTable = MmMapLockedPages(g_pMdlSystemCall, KernelMode);
if( ( KeServiceDescriptorTableShadow != NULL && NULL != OrgNtGdiBitBlt))
{
//hook shadow system calls and save old system call locations
UNHOOK_SYSCALL( NtGdiBitBltIndex, OrgNtGdiBitBlt, HookNtGdiBitBlt );
}
else{
KeServiceDescriptorTableShadow = NULL;
}
MmUnmapLockedPages(MappedSystemCallTable, g_pMdlSystemCall);
MmUnlockPages(g_pMdlSystemCall);
IoFreeMdl(g_pMdlSystemCall);
......
这段代码在xp下运行正常,但是在2k下面运行之后Shadow SSDT所在的内存被解除影射了,导致所在的进程访问无效内存--蓝屏
如果去掉MmUnmapLockedPages MmUnlockPages就是正常的
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
- [原创]深圳腾讯[第一阶段 第四题]脱壳脚本 6268
- [求助]哪里可以下载wdk 6001 14555
- [求助]2k下修改只读内存释放pages蓝屏 4436
- [原创]4.PE文件挑战题 1848
- [求助]如何添加链接选项使得整个dll的所有节都有共享属性? 4896
看原图
赞赏
雪币:
留言: