Microsoft windows nt!ntqueryvirtualmemory (memory(privileged)basicinformation) kernel 64bit stack memory disclosure Vulnerability / Exploit
/
/
/
Exploits / Vulnerability Discovered : 2018-04-16 |
Type : dos |
Platform : windows
This exploit / vulnerability Microsoft windows nt!ntqueryvirtualmemory (memory(privileged)basicinformation) kernel 64bit stack memory disclosure is for educational purposes only and if it is used you will do on your own risk!
[+] Code ...
/*
We have discovered that the nt!NtQueryVirtualMemory system call invoked with the MemoryBasicInformation (0x0) and MemoryPrivilegedBasicInformation (0x8) information classes discloses uninitialized kernel stack memory to user-mode clients. The vulnerability affects 64-bit versions of Windows 7 to 10.
Both information classes appear to return the same output structure, MEMORY_BASIC_INFORMATION:
On x64 builds, the compiler introduces 4 bytes of padding between the "AllocationProtect" and "RegionSize" fields, in order to align the latter to an 8-byte boundary. Furthermore, 4 extra unused bytes are also added at the end of the structure, in order to align its size to an 8-byte boundary. None of these 8 unused bytes are initialized in the kernel's local copy of the structure, and so they are returned to the user-mode caller in this undefined form.
The problem is best illustrated by running the attached proof-of-concept program, which sprays the kernel stack with a 0x41 ('A') marker byte, invokes the nt!NtQueryVirtualMemory syscall with the affected information classes, and prints the contents of the output buffer on the screen. The result of running it in our test Windows 10 environment is as follows:
It is clearly visible that in both cases, the bytes returned at offsets 0x14-0x17 and 0x2c-0x2f originate from an uninitialized kernel stack region. Repeatedly triggering the vulnerability could allow local authenticated attackers to defeat certain exploit mitigations (kernel ASLR) or read other secrets stored in the kernel address space.
*/