Skip to content
Memory corruption Write-up Advanced

UAF vulnerability in the Menu Management Component of Window Manager

A use-after-free exists in the Windows win32k menu management code: after freeing the root popup menu object, the global menu state field is not cleared, leaving a dangling pointer that can be reused or double-freed. An attacker could reallocate that freed memory with a fake popup menu and flip a window's server-side procedure flag so their own code runs in kernel context, escalating privileges.

xiaodaozhi.com

Published on xiaodaozhi.com

CVE-2017-0263 is a UAF vulnerability in Menu Management Component in win32k kernel module of Windows operating system, which was reported to be used to attack with an EPS vulnerability to interfere the French election. This article will simply analyze the CVE-2017-0263 part of the attacking sample in order to come up…

The author, on xiaodaozhi.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the menu teardown function frees the root popup menu object but never nulls the pointer to it, and a user-mode callback during teardown allows re-entry that double-frees or reuses the freed memory.

Impact

The double-free could crash the system (BSOD), and with careful memory layout an attacker could execute their own code in kernel context to gain elevated privileges.

What the attacker needed

Local code execution on the target; Windows 7 x86 SP1 environment

How it was found

  1. Create menu window objects with special associations and properties from the user process.
  2. Trigger the menu teardown path so the root popup menu object is freed.
  3. During the callback into user mode before the thread menu state is reset, change the popup menu state to re-enter the teardown function.
  4. Reallocate a same-sized block to occupy the freed memory and fake a new root popup menu object.
  5. Use the fake object to modify the server-side window procedure flag of a chosen window.
  6. Get the custom window procedure executed in kernel context to run shellcode and elevate privileges.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a program frees a piece of memory it should also forget the address, otherwise it may later use memory that no longer belongs to it. Here the menu code kept such a stale address, and an attacker who can fill that memory with their own data can trick the system into running their code with high privileges. This is called a use-after-free bug.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.