Twenty Year Anniversary

Windows Kernel win32k!SfnINOUTLPWINDOWPOS Memory Disclosure

Windows Kernel win32k!SfnINOUTLPWINDOWPOS Memory Disclosure
Posted Feb 22, 2018
Authored by Google Security Research, mjurczyk

The 64-bit Windows kernel suffers from a pool memory disclosure vulnerability in win32k!SfnINOUTLPWINDOWPOS (via user-mode callback).

tags | advisory, kernel
systems | windows
advisories | CVE-2018-0810
MD5 | 9c567298b0ec80585c4b62f8cb2074d5

Windows Kernel win32k!SfnINOUTLPWINDOWPOS Memory Disclosure

Change Mirror Download
Windows Kernel 64-bit pool memory disclosure in win32k!SfnINOUTLPWINDOWPOS (via user-mode callback) 

CVE-2018-0810


We have discovered that a user-mode callback invoked by the win32k!SfnINOUTLPWINDOWPOS function (via KeUserModeCallback) leads to the disclosure of uninitialized pool memory to user-mode clients, due to compiler-introduced structure padding. The vulnerability affects Windows 7 64-bit; other versions of Windows have not been tested.

The act of copying uninitialized kernel memory has been detected under a number of different stack traces. One example is shown below, and the full list can be found in the attached file.

--- cut ---
#0 0xfffff80002684830 ((00067830) ntoskrnl.exe!memcpy+00000000)
#1 0xfffff8000297dbf0 ((00360bf0) ntoskrnl.exe!KeUserModeCallback+000000a4)
#2 0xfffff960000e649b ((000a649b) win32k.sys!SfnINOUTLPWINDOWPOS+0000014b)
#3 0xfffff9600010e45b ((000ce45b) win32k.sys!xxxSendMessageToClient+000001f7)
#4 0xfffff9600010dca3 ((000cdca3) win32k.sys!xxxSendMessageTimeout+000002b6)
#5 0xfffff960000d9bc1 ((00099bc1) win32k.sys!xxxCalcValidRects+000001bd)
#6 0xfffff960000dbddb ((0009bddb) win32k.sys!xxxEndDeferWindowPosEx+000001d3)
#7 0xfffff960000dbbc6 ((0009bbc6) win32k.sys!xxxSetWindowPos+00000156)
#8 0xfffff960000d060d ((0009060d) win32k.sys!xxxShowWindow+0000037d)
#9 0xfffff960000df113 ((0009f113) win32k.sys!NtUserShowWindow+000000e3)
#10 0xfffff8000268d093 ((00070093) ntoskrnl.exe!KiSystemServiceCopyEnd+00000013)
--- cut ---

At that point of execution, 0x50 bytes are copied from kernel to user-mode. The layout of the i/o structure passed down to the user-mode callback that we're seeing is as follows:

--- cut ---
00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030: 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ................
00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
--- cut ---

Where 00 denote bytes which are properly initialized, while ff indicate uninitialized values copied back to user-mode. As shown above, there are 4 bytes leaked at offsets 0x3c-0x3f. We have determined that these bytes originally come from a smaller structure of size 0x28, which is passed down to win32k!SfnINOUTLPWINDOWPOS through the 4th argument, and copied into offset 0x18 of the overall memory area passed to ring-3. More specifically, we have found that the nested structure is most likely of type WINDOWPOS, and the uninitialized bytes correspond to the 4 bytes of padding inserted at the end of the structure on x64 builds, to align it to an 8-byte boundary of 40 (0x28) bytes.

--- cut ---
typedef struct tagWINDOWPOS {
HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;
} WINDOWPOS, *LPWINDOWPOS, *PWINDOWPOS;
--- cut ---

Our instrumentation indicates that the list of unique origins of the leaked pool bytes (callers of the ExAllocatePoolWithTag() function) is as follows:

1) win32k.sys!AllocateCvr+0000003f
2) ntoskrnl.exe!ExAllocatePoolWithQuotaTag+00000055
3) win32k.sys!UserReAllocPoolWithTag+0000002e
4) win32k.sys!DestroySMWP+000000c1

A proof-of-concept program is not provided for this issue, but it has been observed and confirmed 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

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

December 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    11 Files
  • 2
    Dec 2nd
    1 Files
  • 3
    Dec 3rd
    18 Files
  • 4
    Dec 4th
    40 Files
  • 5
    Dec 5th
    16 Files
  • 6
    Dec 6th
    50 Files
  • 7
    Dec 7th
    12 Files
  • 8
    Dec 8th
    1 Files
  • 9
    Dec 9th
    1 Files
  • 10
    Dec 10th
    15 Files
  • 11
    Dec 11th
    30 Files
  • 12
    Dec 12th
    25 Files
  • 13
    Dec 13th
    15 Files
  • 14
    Dec 14th
    14 Files
  • 15
    Dec 15th
    2 Files
  • 16
    Dec 16th
    3 Files
  • 17
    Dec 17th
    15 Files
  • 18
    Dec 18th
    15 Files
  • 19
    Dec 19th
    4 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close