1.1
BAYET Corentin
2017
1.2
2.1
Place for every allocation in the windows kernel
Common for every drivers
Specific allocator and structures
Several types:
NonPagedPool
PagedPool
....
Basically, a list of pages fragmented in chunks !
2.2
2.3
IOCTL: Input/Ouput Control
BOOL WINAPI DeviceIoControl(
_In_ HANDLE hDevice,
_In_ DWORD dwIoControlCode,
_In_opt_ LPVOID lpInBuffer,
_In_ DWORD nInBufferSize,
_Out_opt_ LPVOID lpOutBuffer,
_In_ DWORD nOutBufferSize,
_Out_opt_ LPDWORD lpBytesReturned,
_Inout_opt_ LPOVERLAPPED lpOverlapped
);
I/O Control Code
2.4
METHOD_BUFFERED:
So we control the size of the buffer used for input and ouput in drivers... Great Attack Vector !
2.5
About CVE-2017-6008
A memcpy is called with following arguments:
Classic Buffer Overflow... But in the NonPagedPool !
2.6
2.7
Points to data controlled by attacker
2.8
3.1
Process Billed encoded:
PoolCookie XOR Chunk Address XOR Pointer
Checked before use
3.2
Goal: exploit the very same pool buffer overflow on Windows 10
3.3
Seems impossible...
3.4
4.1
4.2
4.3
4.4
4.5
4.6
Windows named objects :
5.1
In userland, use a handle to interact with the object !
5.2
AKA : Massively allocate chunks
6.1
User-land
Kernel-land
CloseHandle()
Chunks are freed and coalesced
6.2
We can fix this
6.3
SystemExtendedHandleInformation
Retrieve any object's kernel address using its handle
6.4
7.1
Leak addresses
Check if offsets are correct
7.2
7.3
8.1
CreatePrivateNamespace() Function:
In paged pool, in the chunk of the object allocated
8.2
8.3
8.4
8.5
Process Billed encoded:
PoolCookie XOR Chunk Address XOR Pointer
Process Billed encoded:
PoolCookie XOR Chunk Address
8.6
8.7
8.8
Let's exploit !
9.1
Drivers are still a great attack vector:
Be careful when writing a driver...
Completely remediate the NtQuerySystemInformation leak !
10.1
10.2
I'm interested in job offers !