Twenty Year Anniversary

Windows Kernel win32k!fnHkINLPMOUSEHOOKSTRUCTEX Memory Disclosure

Windows Kernel win32k!fnHkINLPMOUSEHOOKSTRUCTEX 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!fnHkINLPMOUSEHOOKSTRUCTEX (via user-mode callback).

tags | advisory, kernel
systems | windows
advisories | CVE-2018-0810
MD5 | 51df2fe0cf72e749bba708e2ea83d84a

Windows Kernel win32k!fnHkINLPMOUSEHOOKSTRUCTEX Memory Disclosure

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

CVE-2018-0810


We have discovered that a user-mode callback invoked by the win32k!fnHkINLPMOUSEHOOKSTRUCTEX 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 a number of different stack traces. One example is shown below:

--- cut ---
#0 0xfffff80002684830 ((00067830) ntoskrnl.exe!memcpy+00000000)
#1 0xfffff8000297dbf0 ((00360bf0) ntoskrnl.exe!KeUserModeCallback+000000a4)
#2 0xfffff9600018efe3 ((0014efe3) win32k.sys!fnHkINLPMOUSEHOOKSTRUCTEX+000000a3)
#3 0xfffff960000d12c9 ((000912c9) win32k.sys!xxxCallCtfHook+00000155)
#4 0xfffff960000d2af6 ((00092af6) win32k.sys!xxxScanSysQueue+000017da)
#5 0xfffff9600010ce4f ((000cce4f) win32k.sys!xxxRealInternalGetMessage+00000453)
#6 0xfffff9600011a4c5 ((000da4c5) win32k.sys!NtUserRealInternalGetMessage+00000095)
#7 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 ff ff ff ff ................
--- cut ---

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

--- cut ---
typedef struct tagMOUSEHOOKSTRUCT {
POINT pt;
HWND hwnd;
UINT wHitTestCode;
ULONG_PTR dwExtraInfo;
} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT;

typedef struct tagMOUSEHOOKSTRUCTEX {
MOUSEHOOKSTRUCT MOUSEHOOKSTRUCT;
DWORD mouseData;
} MOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX;
--- cut ---

In all observed cases, the origin of the leaked stack bytes is the stack frame of the win32k.sys!xxxScanSysQueue 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:

April 2018

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