-
Notifications
You must be signed in to change notification settings - Fork 1
/
detect.poc.pooltag.cpp
40 lines (34 loc) · 1 KB
/
detect.poc.pooltag.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "detect.h"
#include "util.h"
bool
AntiKernelDbgByPoolTag()
{
bool bKdbg = false;
PSYSTEM_POOLTAG_INFORMATION pPoolTagTable = NULL;
do
{
NTSTATUS lStatus = EnumPoolTagTable(&pPoolTagTable);
if (!NT_SUCCESS(lStatus))
{
break;
}
ULONG uCount = pPoolTagTable->Count;
for (ULONG i = 0; i < uCount; ++i)
{
auto pPoolTagInfo = pPoolTagTable->TagInfo[i];
if (pPoolTagInfo.TagUlong == 'oIdK' && pPoolTagInfo.PagedAllocs == 0 && pPoolTagInfo.PagedFrees == 0 &&
pPoolTagInfo.PagedUsed == 0 && pPoolTagInfo.NonPagedUsed >= PAGE_SIZE &&
pPoolTagInfo.NonPagedUsed < 10 * PAGE_SIZE && pPoolTagInfo.NonPagedAllocs > 0x30 &&
pPoolTagInfo.NonPagedFrees > 0x30)
{
bKdbg = true;
break;
}
}
} while (0);
if (pPoolTagTable)
{
ExFreePoolWithTag(pPoolTagTable, 'haha');
}
return bKdbg;
}