# Understanding Windows Kernel Pool Memory

Listen to this Post

The Windows Kernel Pool Memory is a critical component of the Windows operating system, responsible for dynamic memory allocation used by kernel-mode components. Understanding its internals is essential for vulnerability research and kernel exploitation.

Read the full article here: Understanding Windows Kernel Pool Memory

You Should Know:

Key Concepts of Kernel Pool Memory

1. Pool Types:

  • Non-Paged Pool: Reserved for critical kernel operations that cannot trigger page faults.
  • Paged Pool: Can be swapped to disk when not in use.

2. Pool Allocation Functions:

– `ExAllocatePoolWithTag` – Allocates kernel memory with a custom tag.
– `ExFreePoolWithTag` – Frees allocated memory (must match the tag).

3. Pool Corruption Vulnerabilities:

  • Use-after-free (UAF)
  • Buffer overflows
  • Double-free

Practical Kernel Pool Exploitation Steps

1. Identify a Vulnerable Driver:

!poolused 2 # (WinDbg command to analyze pool usage)

2. Trigger the Vulnerability:

HANDLE hDevice = CreateFileA("\\.\VulnerableDriver", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
DeviceIoControl(hDevice, VULN_IOCTL, inputBuffer, inputSize, NULL, 0, &bytesReturned, NULL);

3. Exploit the Corruption:

  • Spray the pool to control memory layout.
  • Overwrite function pointers or object structures.

4. Escalate Privileges:

nt!SeSetAccessStateTokenPrivilege # (Used in privilege escalation exploits)

Debugging Kernel Pool Issues