Skip to content
Memory corruption Write-up Advanced

CVE-2014-4113 Patch and Vulnerability Analysis

A local privilege escalation flaw in the Windows kernel driver win32k.sys allowed an attacker with low privileges to gain SYSTEM access by exploiting a missing check on a window handle, leading to execution of a callback function from a fake object at the null page.

codeandsec.com

Published on codeandsec.com

As you might have heard, Microsoft recently patched some vulnerabilities; vulnerabilities related to Sandworm CVE-2014-4114(Powerpoint exploit) and font parsing (CVE-2014-4148). But in this article, I'm more interested to talk about CVE-2014-4113, which is a local kernel vulnerability that successful exploitation…

The author, on codeandsec.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 function xxxHandleMenuMessages did not validate the return value of xxxMNFindWindowFromPoint before using it as a window handle, allowing a crafted negative value to point to attacker-controlled memory.

Impact

An attacker with low privileges could gain SYSTEM access, and any process created afterwards would also have SYSTEM token.

What the attacker needed

Local access to the system; ability to run code with low privileges; Windows version vulnerable to CVE-2014-4113

How it was found

  1. Create a two-layer popup menu and call TrackPopupMenu to trigger a hook.
  2. In the hook function, replace the window handler using SetWindowLongA.
  3. The new handler deletes the popup menu and returns -5 (0xFFFFFFFB).
  4. Allocate the zero page and write a fake tagWND object with the WS_EXECUTE_IN_KERNEL flag and a callback address.
  5. The kernel then calls the callback function at the null page in kernel space, executing shellcode that replaces the process token with the SYSTEM token.

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.

This is a bug in a core part of Windows that manages windows and menus. A user with limited rights could trick the system into running their code with the highest privileges, because a check was missing when handling a menu message. The attacker had to prepare a fake object in memory and trigger a specific menu action.

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.