Skip to content
Memory corruption Write-up Advanced

Bad Binder: Android In-the-Wild Exploit

A use-after-free in the Android Binder kernel driver let an unprivileged process inside Chrome's renderer sandbox corrupt kernel memory, and the write-up explains how a proof-of-concept raised the process's address limit to gain arbitrary kernel read and write. Chained with a browser renderer exploit, this could fully compromise a vulnerable device.

googleprojectzero.blogspot.com

Published on googleprojectzero.blogspot.com

On October 3, 2019, we disclosed issue 1942 (CVE-2019-2215), which is a use-after-free in Binder in the Android kernel. The bug is a local privilege escalation vulnerability that allows for a full compromise of a vulnerable device.

The author, on googleprojectzero.blogspot.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 Binder driver told epoll to watch a wait queue embedded in a thread structure that could be freed while epoll still referenced it, instead of using POLLFREE to detach watchers on release.

Impact

An unprivileged app inside the Chrome sandbox could gain arbitrary kernel read and write, and chained with a renderer exploit it could fully compromise a device; the technique fails when CONFIG_DEBUG_LIST is enabled and is hindered by CONFIG_ARM64_UAO.

What the attacker needed

Code running in Chrome's renderer sandbox; vulnerable Android kernel (e.g. Pixel 1 or 2); CONFIG_DEBUG_LIST disabled

The fix

The bug was fixed in several kernel branches in February 2018, but because the fix never appeared in a monthly Android bulletin many released devices stayed vulnerable until updates were issued in October 2019.

How it was found

  1. Open the Binder device and create an epoll instance.
  2. Register the Binder file descriptor with epoll for read events.
  3. Issue the Binder thread exit ioctl, which frees the thread structure still referenced by epoll.
  4. Reallocate the freed memory with a vectored I/O array sized to match.
  5. Block the I/O so a separate thread removes the epoll watch, triggering the unlink on attacker-controlled values.
  6. Use the resulting scoped kernel read to leak the task structure, then repeat for a scoped write to raise the address limit.

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.

A driver in the phone's core (the kernel) kept a pointer to a small piece of memory after that memory had been handed back for reuse. If an attacker arranges for their own data to land in that reused spot, they can make the kernel follow pointers they control, which is a step towards taking over the whole device. The report also shows how the bug was tracked down from vague hints about an exploit already being used in the wild.

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.