New issue
Advanced search Search tips
Starred by 2 users

Issue metadata

Status: Fixed
Closed: Sep 2017

Sign in to add a comment

Issue 1267: Windows Kernel pool memory disclosure in win32k!NtGdiGetGlyphOutline

Reported by, May 31 2017 Project Member

Issue description

We have discovered that the win32k!NtGdiGetGlyphOutline system call handler may disclose large portions of uninitialized pool memory to user-mode clients.

The function first allocates memory (using win32k!AllocFreeTmpBuffer) with a user-controlled size, then fills it with the outline data via win32k!GreGetGlyphOutlineInternal, and lastly copies the entire buffer back into user-mode address space. If the amount of data written by win32k!GreGetGlyphOutlineInternal is smaller than the size of the allocated memory region, the remaining part will stay uninitialized and will be copied in this form to the ring-3 client.

The bug can be triggered through the official GetGlyphOutline() API, which is a simple wrapper around the affected system call. The information disclosure is particularly severe because it allows the attacker to leak an arbitrary number of bytes from an arbitrarily-sized allocation, potentially enabling them to "collide" with certain interesting objects in memory.

Please note that the win32k!AllocFreeTmpBuffer routine works by first attempting to return a static block of 4096 bytes (win32k!gpTmpGlobalFree) for optimization, and only when it is already busy, a regular pool allocation is made. As a result, the attached PoC program will dump the contents of that memory region in most instances. However, if we enable the Special Pools mechanism for win32k.sys and start the program in a loop, we will occasionally see output similar to the following (for 64 leaked bytes). The repeated 0x67 byte in this case is the random marker inserted by Special Pools.

--- cut ---
00000000: 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 gggggggggggggggg
00000010: 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 gggggggggggggggg
00000020: 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 gggggggggggggggg
00000030: 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 gggggggggggggggg
--- cut ---

Interestingly, the bug is only present on Windows 7 and 8. On Windows 10, the following memset() call was added:

--- cut ---
.text:0018DD88 loc_18DD88:                             ; CODE XREF: NtGdiGetGlyphOutline(x,x,x,x,x,x,x,x)+5D
.text:0018DD88                 push    ebx             ; size_t
.text:0018DD89                 push    0               ; int
.text:0018DD8B                 push    esi             ; void *
.text:0018DD8C                 call    _memset
--- cut ---

The above code pads the overall memory area with zeros, thus preventing any kind of information disclosure. This suggests that the issue was identified internally by Microsoft but only fixed in Windows 10 and not backported to earlier versions of the system.

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.
2.9 KB View Download

Comment 1 by, May 31 2017

Project Member
Description: Show this description

Comment 2 by, May 31 2017

Project Member
Labels: Reported-2017-May-31

Comment 3 by, May 31 2017

Project Member
Labels: MSRC-38994

Comment 4 by, Aug 7 2017

Project Member
Labels: CVE-2017-8680

Comment 5 by, Aug 25 2017

Project Member
Labels: Deadline-Exceeded Deadline-Grace
The bug is scheduled to be fixed in the September Patch Tuesday.

Comment 6 by, Sep 12 2017

Project Member
Labels: Fixed-2017-Sep-12
Status: Fixed (was: New)
Fixed in today's Patch Tuesday.

Comment 7 by, Sep 18 2017

Project Member
Labels: -Restrict-view-commit

Sign in to add a comment