Twenty Year Anniversary

Windows Kernel win32k!SfnINLPHELPINFOSTRUCT Memory Disclosure

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

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

tags | advisory, kernel
systems | windows
advisories | CVE-2018-0810
MD5 | 27c78eb28b55312aa2809afbc0d3b311

Windows Kernel win32k!SfnINLPHELPINFOSTRUCT Memory Disclosure

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

CVE-2018-0810


We have discovered that a user-mode callback invoked by the win32k!SfnINLPHELPINFOSTRUCT function (via KeUserModeCallback) leads to the disclosure of uninitialized stack 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 the following stack trace:

--- cut ---
#0 0xfffff80002684830 ((00067830) ntoskrnl.exe!memcpy+00000000)
#1 0xfffff8000297dbf0 ((00360bf0) ntoskrnl.exe!KeUserModeCallback+000000a4)
#2 0xfffff9600018c282 ((0014c282) win32k.sys!SfnINLPHELPINFOSTRUCT+000001c2)
#3 0xfffff9600010e45b ((000ce45b) win32k.sys!xxxSendMessageToClient+000001f7)
#4 0xfffff9600010dca3 ((000cdca3) win32k.sys!xxxSendMessageTimeout+000002b6)
#5 0xfffff960001bb557 ((0017b557) win32k.sys!xxxSendHelpMessage+0000007f)
#6 0xfffff960000ec960 ((000ac960) win32k.sys!xxxRealDefWindowProc+00000700)
#7 0xfffff960000f3b54 ((000b3b54) win32k.sys!xxxWrapRealDefWindowProc+0000003c)
#8 0xfffff960000e5847 ((000a5847) win32k.sys!NtUserfnNCDESTROY+00000027)
#9 0xfffff960000f302e ((000b302e) win32k.sys!NtUserMessageCall+0000012e)
#10 0xfffff8000268d093 ((00070093) ntoskrnl.exe!KiSystemServiceCopyEnd+00000013)
--- cut ---

At that point of execution, 0x88 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 00 00 00 00 ................
00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ................
00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000080: 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 0x6c-0x6f. We have determined that these bytes originally come from a smaller structure of size 0x28, which is passed down to win32k!SfnINLPHELPINFOSTRUCT through the 4th argument, and copied into offset 0x60 of the overall memory area passed to ring-3. More specifically, we have found that the nested structure is most likely of type HELPINFO, and the uninitialized bytes correspond to the 4 bytes of padding between the iCtrlId and hItemHandle fields, inserted by the compiler to align the latter to an 8-byte boundary.

--- cut ---
typedef struct tagHELPINFO {
UINT cbSize;
int iContextType;
int iCtrlId;
HANDLE hItemHandle;
DWORD dwContextId;
POINT MousePos;
} HELPINFO, *LPHELPINFO;
--- cut ---

The origin of the leaked bytes is the stack frame of the win32k!xxxSendHelpMessage function.

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

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

July 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    1 Files
  • 2
    Jul 2nd
    26 Files
  • 3
    Jul 3rd
    15 Files
  • 4
    Jul 4th
    11 Files
  • 5
    Jul 5th
    13 Files
  • 6
    Jul 6th
    4 Files
  • 7
    Jul 7th
    4 Files
  • 8
    Jul 8th
    1 Files
  • 9
    Jul 9th
    16 Files
  • 10
    Jul 10th
    15 Files
  • 11
    Jul 11th
    32 Files
  • 12
    Jul 12th
    22 Files
  • 13
    Jul 13th
    15 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 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