能力值:
( LV9,RANK:380 )
2 楼
ZwQueryVirtualMemory是从vadtree里面取得信息,直接抹去vadtree就可以了。
lkd> dt_eprocess
nt!_EPROCESS
...
...
+0x250 VadRoot : _MM_AVL_TABLE
能力值:
( LV2,RANK:10 )
3 楼
恩,谢谢指点
参考别人的代码,自己改了下,可以隐藏,分享如下: 系统是XP SP3
PUNICODE_STRING GetPath(ULONG mmVad) //获取模块全路径
{
PUNICODE_STRING pPath;
ULONG ca;//_CONTROL_AREA
ULONG fp;//_FILE_OBJECT
ca = *(ULONG *)(mmVad + 0x018);//+0x018 ControlArea : Ptr32 _CONTROL_AREA
if( !MmIsAddressValid( (ULONG *)ca ) )
{
//dprintf("[EnumModules] ControlArea is not available : 0x%X",ca);
return NULL;
}
fp = *(ULONG *)(ca + 0x024); //+0x024 FilePointer : Ptr32 _FILE_OBJECT
if( !MmIsAddressValid( (ULONG *)fp ) )
{
//dprintf("[EnumModules] FileObject is not available : 0x%X",fp);
return NULL;
}
pPath = (PUNICODE_STRING)(fp + 0x030); //+0x030 FileName : _UNICODE_STRING
//dprintf("[EnumModules] The file name is %S",pPath->Buffer);
//dprintf("[EnumModules] The MMVAD is 0x%X",mmVad);
//dprintf("\n");
//nCount++;//计数
return pPath;
}
VOID PreOrderTraverse(ULONG mmVad, WCHAR * pszModName)
{
PUNICODE_STRING pPath;
if ( MmIsAddressValid( (ULONG *)mmVad ) )
{
pPath = GetPath(mmVad);//读取地址
if (pPath != NULL && pPath->Length > 0 && wcsstr(pPath->Buffer, pszModName) != NULL)
{
DbgPrint("find module name %s, delete it", pszModName);
RtlZeroMemory(pPath->Buffer,pPath->Length);
pPath->Length = 0;
pPath->MaximumLength = 0;
}
else
{
PreOrderTraverse( *(ULONG *)(mmVad + 0x00c) , pszModName); // +0x00c LeftChild : Ptr32 _MMVAD
PreOrderTraverse( *(ULONG *)(mmVad + 0x010) , pszModName); //+0x010 RightChild : Ptr32 _MMVAD
}
}
} //遍历指定PID进程的VAD树,搜索指定的模块名
NTSTATUS HideProcessModuleByName(int nPid, WCHAR * pszModName)
{
ULONG VAD;
PEPROCESS TargetProcess;
////////////////////////////////////////
PsLookupProcessByProcessId( (HANDLE)nPid, &TargetProcess);
if(!TargetProcess)
{
KdPrint(("[EnumModules] Error on Get EProcess By Pid."));
return STATUS_UNSUCCESSFUL;
}
VAD = *(ULONG *)((ULONG)TargetProcess + 0x11c); //+0x11c VadRoot : Ptr32 Void
DbgPrint("[EnumModules] EPROCESS : 0x%X , VAD : 0x%X",TargetProcess,VAD);
PreOrderTraverse(VAD, pszModName); //遍历二叉树。。。
//DbgPrint("[EnumModules] Modules count : %d",nCount);
return STATUS_SUCCESS;
}