The Microsoft Windows kernel suffers from a 64-bit pool memory disclosure vulnerability in win32k!PROXYPORT::SendRequest.
c4d2ec2f03999cf0e9586f23b01f54a9
Windows Kernel 64-bit stack memory disclosure in win32k!PROXYPORT::SendRequest
CVE-2018-0814
We have discovered that the win32k!PROXYPORT::SendRequest function sends ALPC messages with portions of uninitialized memory from the local stack frame on Windows 7 64-bit (other versions were not tested).
The message is 0x20 bytes long, 8 of which are uninitialized. The layout of the memory area is as follows:
--- cut ---
00000000: 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 ................
00000010: 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 ................
--- cut ---
Where 00 denote bytes which are properly initialized, while ff indicate uninitialized values. Based on a brief analysis of the win32k!PROXYPORT::SendRequest function code, we suspect that the memory region is in fact a structure, where the 1st and 3rd fields are 32-bit wide, while the 2nd and 4th fields are 64-bit wide (e.g. pointers). Such layout would cause the compiler to insert the two 4-byte padding holes, in order to align the 64-bit fields to 8-byte boundaries. This would also explain why the bug hasn't previously manifested itself on 32-bit builds of Windows.
The buffer is typically read back with the NtReplyWaitReceivePort syscall by the splwow64.exe process, as observed during system runtime on our test machine:
--- cut ---
kd> k
# Child-SP RetAddr Call Site
00 fffff880`03841a98 fffff800`029a9c3b nt!memcpy+0x3
01 fffff880`03841aa0 fffff800`029a9f63 nt!AlpcpReceiveLegacyMessage+0x1ea
02 fffff880`03841b40 fffff800`029a9e33 nt!NtReplyWaitReceivePortEx+0x122
03 fffff880`03841be0 fffff800`0268d093 nt!NtReplyWaitReceivePort+0xf
04 fffff880`03841c20 00000000`772abdea nt!KiSystemServiceCopyEnd+0x13
05 00000000`01e9f928 00000000`ffc6a8a2 ntdll!NtReplyWaitReceivePort+0xa
06 00000000`01e9f930 00000000`771559cd splwow64!LPCConnMsgsServingThread+0x6a
07 00000000`01e9f9d0 00000000`7728a561 kernel32!BaseThreadInitThunk+0xd
08 00000000`01e9fa00 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
kd> db rdx rdx+r8-1
fffff8a0`02fe4d60 20 00 00 00 bb bb bb bb-68 00 83 02 00 00 00 00 .......h.......
fffff8a0`02fe4d70 08 00 00 00 bb bb bb bb-88 00 83 02 00 00 00 00 ................
--- cut ---
As the splwow64.exe process runs with the privileges of the local user, we believe no special rights in the system are required to access the disclosed kernel memory. A proof-of-concept program is not provided for this issue, but it has been observed at normal system runtime, and is quite evident in the code.
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.
This bug is subject to a 90 day disclosure deadline. After 90 days elapse or a patch has been made broadly available, the bug report will become visible to the public.
Found by: mjurczyk