New issue
Advanced search Search tips

Issue 1362 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Cc:



Sign in to add a comment

Windows Kernel stack memory disclosure in win32k!xxxSendMenuSelect (via fnHkINLPMSG user-mode callback)

Project Member Reported by mjurczyk@google.com, Sep 14 2017

Issue description

We have discovered that the win32k!xxxSendMenuSelect function has a bug which leads to the disclosure of uninitialized stack memory to user-mode clients, due to unused fields in a structure which ends up copied to userland.

The act of copying uninitialized kernel memory was originally detected under the following stack trace:

--- cut ---
  957836ec 82abe89d nt!memcpy+0x35
  95783748 91161d46 nt!KeUserModeCallback+0xc6
  957837ec 9111ffe8 win32k!fnHkINLPMSG+0x148
  9578384c 911658b3 win32k!xxxHkCallHook+0x337
  957838ec 9115ab70 win32k!xxxCallHook2+0x3ac
  95783908 91227798 win32k!xxxCallHook+0x26
  95783928 9121acd1 win32k!_CallMsgFilter+0x71
  95783960 911f22aa win32k!xxxSendMenuSelect+0xce
  957839c0 9120f5a9 win32k!xxxMNInvertItem+0x3ae
  95783a2c 912452f9 win32k!xxxMNSelectItem+0x216
  95783aa0 912141a4 win32k!xxxRealMenuWindowProc+0xba3
  95783ad4 9118c593 win32k!xxxMenuWindowProc+0xfd
  95783b14 9118c665 win32k!xxxSendMessageTimeout+0x1ac
  95783b3c 9120f0d5 win32k!xxxSendMessage+0x28
  95783b8c 9120ebcc win32k!xxxMNMouseMove+0x177
  95783be8 9120e784 win32k!xxxHandleMenuMessages+0x310
  95783c34 912147d3 win32k!xxxMNLoop+0x2fa
  95783ca0 912148be win32k!xxxTrackPopupMenuEx+0x5fd
  95783d14 8287ee06 win32k!NtUserTrackPopupMenuEx+0xc3
  95783d14 77236c74 nt!KiSystemServicePostCall
  000bf210 757a480e ntdll!KiFastSystemCallRet
  000bf214 0055342c USER32!NtUserTrackPopupMenuEx+0xc
--- cut ---

At that point of execution, 0x30 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: ff ff ff ff ff ff ff ff ff ff ff ff 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 12 bytes leaked at offsets 0x20-0x2b. We have determined that these bytes originally come from a smaller structure of size 0x1c, allocated in the stack frame of the win32k!xxxSendMenuSelect function. More specifically, we have found that the local structure is in fact of type MSG, and the uninitialized bytes correspond to the trailing "time" and "pt" fields:

--- cut ---
  typedef struct tagMSG {
    HWND   hwnd;
    UINT   message;
    WPARAM wParam;
    LPARAM lParam;
    DWORD  time;
    POINT  pt;
  } MSG, *PMSG, *LPMSG;
--- cut ---

Such a partially initialized structure is then passed down to win32k!_CallMsgFilter, and further down the call stack, before being eventually leaked to ring-3 through the user-mode callback. 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.
 
Project Member

Comment 1 by mjurczyk@google.com, Sep 14 2017

Labels: Reported-2017-Sep-14
Project Member

Comment 2 by mjurczyk@google.com, Sep 14 2017

Labels: MSRC-40833
Project Member

Comment 3 by mjurczyk@google.com, Oct 17 2017

Labels: CVE-2017-11853
Project Member

Comment 4 by mjurczyk@google.com, Nov 15 2017

Labels: Fixed-2017-Nov-14
Status: Fixed (was: New)
Fixed in yesterday's Patch Tuesday.
Project Member

Comment 5 by mjurczyk@google.com, Nov 21 2017

Labels: -Restrict-View-Commit

Sign in to add a comment