New issue
Advanced search Search tips
Starred by 2 users
Status: Fixed
Owner:
Closed: Sep 12
Cc:



Sign in to add a comment
Windows Kernel pool memory disclosure in nt!NtSetIoCompletion / nt!NtRemoveIoCompletion
Project Member Reported by mjurczyk@google.com, May 31 2017 Back to list
We have discovered that the nt!NtRemoveIoCompletion system call handler discloses 4 bytes of uninitialized pool memory to user-mode clients on 64-bit platforms.

The bug manifests itself while passing the IO_STATUS_BLOCK structure back to user-mode. The structure is defined as follows:

--- cut ---
  typedef struct _IO_STATUS_BLOCK {
    union {
      NTSTATUS Status;
      PVOID    Pointer;
    };
    ULONG_PTR Information;
  } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
--- cut ---

On 64-bit Windows builds, the "Pointer" field is 64 bits in width while the "Status" field is 32-bits wide. This means that if only "Status" is initialized, the upper 32 bits of "Pointer" remain garbage. This is what happens in the nt!NtSetIoCompletion syscall, which allocates a completion packet with a nested IO_STATUS_BLOCK structure (from the pools or a lookaside list), and only sets the .Status field to a user-controlled 32-bit value, leaving the remaining part of the union untouched.

Furthermore, the nt!NtRemoveIoCompletion system call doesn't rewrite the structure to only pass the relevant data back to user-mode, but copies it in its entirety, thus disclosing the uninitialized 32 bits of memory to the ring-3 client. The attached proof-of-concept program illustrates the problem by triggering the vulnerability in a loop, and printing out the leaked value. When run on Windows 7 x64, we're seeing various upper 32-bit portions of kernel-mode pointers:

--- cut ---
Leak: FFFFF80011111111
Leak: FFFFF80011111111
Leak: FFFFF80011111111
Leak: FFFFF80011111111
...
Leak: FFFFF88011111111
Leak: FFFFF88011111111
Leak: FFFFF88011111111
Leak: FFFFF88011111111
...
Leak: FFFFFA8011111111
Leak: FFFFFA8011111111
Leak: FFFFFA8011111111
Leak: FFFFFA8011111111
--- cut ---

We suspect that the monotony in the nature of the disclosed value is caused by the usage of a lookaside list, and it could likely be overcome by depleting the list and forcing the kernel to fall back on regular pool allocations. 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.

The issue was discovered by James Forshaw of Google Project Zero.

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.
 
IOCompletionInfoLeak.cpp
1.7 KB View Download
Project Member Comment 1 by mjurczyk@google.com, May 31 2017
Labels: Reported-2017-May-31
Project Member Comment 2 by mjurczyk@google.com, May 31 2017
Labels: MSRC-38996
Project Member Comment 3 by mjurczyk@google.com, Aug 14
Labels: CVE-2017-8708
Project Member Comment 4 by mjurczyk@google.com, Aug 25
Labels: Deadline-Exceeded Deadline-Grace
The bug is scheduled to be fixed in the September Patch Tuesday.
Project Member Comment 5 by mjurczyk@google.com, Sep 12
Labels: Fixed-2017-Sep-12
Status: Fixed
Fixed in today's Patch Tuesday.
Project Member Comment 6 by mjurczyk@google.com, Sep 18
Labels: -Restrict-view-commit
Sign in to add a comment