Skip to content
Memory corruption Write-up Advanced

Chaining N-days to Compromise All: Part 2 — Windows Kernel LPE (a.k.a Chrome Sandbox Escape)

A Windows kernel use-after-free in ALPC message handling let a local attacker who already runs code inside the Chrome sandbox escalate to kernel privileges. The flaw is that a message sent with the synchronous-request flag keeps a pointer to the sending thread, and if that thread exits before the message is cleaned up, the pointer dangles.

blog.theori.io

Published on blog.theori.io

Vulnerability Research

The author, on blog.theori.io

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 kernel stored a raw pointer to the sending thread in the message's WaitingThread field and never cleared it when the thread terminated before the message was cancelled, so cleanup dereferenced freed memory.

Impact

An attacker who already has code execution inside the Chrome renderer sandbox could exploit this to gain kernel-level privileges and escape the sandbox, as demonstrated in the authors' full chain.

What the attacker needed

Local code execution in a sandboxed process; Windows kernel vulnerable to CVE-2023-21674

The fix

Microsoft fixed it by making the worker-factory wait system call reject the synchronous-request flag outright.

How it was found

  1. Create an IO completion object and a worker factory object.
  2. Create an anonymous ALPC port.
  3. Build a deferred-work structure pointing at an ALPC message with the synchronous-request flag set.
  4. Call the worker-factory wait system call from a separate thread so the message is sent.
  5. Terminate that thread and close its handle, leaving a dangling pointer in the message.
  6. Close the port so cleanup dereferences the freed thread object.

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.

Windows programs talk to each other through a built-in messaging system called ALPC. When one program sends a message and waits for a reply, the kernel remembers which thread is waiting. If that thread disappears before the reply arrives, the kernel is left holding a note pointing at something that no longer exists, and later uses it, which can corrupt memory and let an attacker take over the machine.

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.