Use after free in Core (CVE-2026-87504)
The chrome.processes.terminate() extension API calls BrowserChildProcessHost::FromID() on the IO thread, but that function and the global child process list are only safe on the UI thread. An attacker with the processes permission could race terminate() calls to cause a heap-use-after-free in the browser process, crashing it.
c6eed09fc8b174b0f3eebedcceb1e792 Follow
Originally disclosed on Chrome VRP
- Fix shipped in 5 months
Cross-thread use-after-free in browser process via chrome.processes.terminate()
Summary
The chrome.processes.terminate() extension API dispatches BrowserChildProcessHost::FromID() to the IO thread, but this function and the global g_child_process_list it iterates are exclusively owned by the UI thread with no synchronization. The only guards are DCHECK_CURRENTLY_ON(BrowserThread::UI) assertions, which are compiled out in release builds. When an extension rapidly calls terminate() on non-renderer child process IDs, the IO thread iterates the list concurrently with the UI thread destroying hosts and removing list nodes, producing a heap-use-after-free in the browser process. ASAN confirms the crash is not protected by MiraclePtr. Affects all desktop platforms (Linux, macOS, Windows). Requires the processes extension permission, currently gated to dev channel.
Bisect
Introducing Commit: 98241839b528f945fabb03f38fb1ea6a3e837f09
- Date: 2016-03-11
- Author: afakhry
- Review: https://codereview.chromium.org/1584473004
Root Cause
ProcessesTerminateFunction::Run() handles two categories of process IDs. For renderer processes it resolves the handle synchronously on the UI thread via RenderProcessHost::FromID(). For non-renderer child processes (utility, GPU, etc.) it posts GetProcessHandleOnIO to the IO thread:
// chrome/browser/extensions/api/processes/processes_api.cc
content::GetIOThreadTaskRunner({})->PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(&ProcessesTerminateFunction::GetProcessHandleOnIO, this,
child_process_host_id_),
base::BindOnce(&ProcessesTerminateFunction::OnProcessHandleOnUI, this));
GetProcessHandleOnIO then calls BrowserChildProcessHost::FromID(), which iterates g_child_process_list:
// content/browser/browser_child_process_host_impl.cc
BrowserChildProcessHost* BrowserChildProcessHost::FromID(int child_process_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
BrowserChildProcessHostImpl::BrowserChildProcessList* process_list =
g_child_process_list.Pointer();
for (BrowserChildProcessHostImpl* host : *process_list) {
if (host->GetData().id == child_process_id)
return host;
}
return nullptr;
}
The DCHECK_CURRENTLY_ON(BrowserThread::UI) assertion is the only thing preventing cross-thread access here, and it vanishes in release builds. The list type is std::list<raw_ptr<BrowserChildProcessHostImpl, CtnExperimental>>, a plain doubly-linked list with no mutex, no lock, and no sequence checker protecting it.
The race unfolds as follows. When an extension fires many terminate() calls targeting non-renderer child processes, each call queues a GetProcessHandleOnIO task on the IO thread. The first successful termination kills a child process (e.g. GPU). The process exit triggers an IPC disconnect notification that propagates through the UI thread: OnChildDisconnected invokes the host delegate's destructor, which calls ForceShutdown():
// content/browser/browser_child_process_host_impl.cc
void BrowserChildProcessHostImpl::ForceShutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
g_child_process_list.Get().remove(this);
child_process_host_->ForceShutdown();
}
This std::list::remove unlinks and frees the list node on the UI thread. Meanwhile, the IO thread is still processing queued FromID() calls, iterating the same list by following next pointers through heap-allocated std::list nodes. When it dereferences a node that the UI thread has already freed, ASAN detects a heap-use-after-free.
The freed 24-byte region is a std::list node containing the raw_ptr<BrowserChildProcessHostImpl> element plus the prev/next pointers. ASAN's additional information confirms "MiraclePtr Status: NOT PROTECTED" because the use-after-free is on the list node itself, not on a raw_ptr-managed object.
A contrasting example exists within the same class. BrowserChildProcessHostIterator (used by code that legitimately needs to enumerate child processes) enforces DCHECK_CURRENTLY_ON(BrowserThread::UI) and is only called from UI-thread code paths. The processes.terminate() handler is the sole caller that incorrectly dispatches FromID() to the IO thread.
Reproduce
Tested at commit f7d73bbd27f24 on Linux x86_64 with the out/asan-release build configuration.
The PoC is a Manifest V3 extension that enumerates non-renderer child processes via chrome.processes.getProcessInfo() and fires concurrent terminate() calls to race the IO-thread lookup against UI-thread host destruction. The directory doubles as a loadable unpacked extension:
issue_processes_terminate_race_uaf/
├── manifest.json # MV3 extension manifest
├── background.js # PoC service worker
A 5ms sleep is inserted in BrowserChildProcessHost::FromID() to widen the race window for reliable reproduction. Apply patch.diff and rebuild:
cd ~/chromium/src
git apply issue_processes_terminate_race_uaf/patch.diff
autoninja -C out/asan-release chrome
Load the extension directory and launch:
ASAN_OPTIONS=detect_odr_violation=0 \
xvfb-run -a out/asan-release/chrome \
--disable-gpu \
--enable-experimental-extension-apis \
--load-extension=issue_processes_terminate_race_uaf \
--user-data-dir=/tmp/poc-$(date +%s) \
--no-first-run \
about:blank
The browser process crashes within seconds with a heap-use-after-free in BrowserChildProcessHost::FromID() on the IO thread, while the UI thread frees a list node via ForceShutdown().
==1272169==ERROR: AddressSanitizer: heap-use-after-free on address 0x7b73c90c1d48 at pc 0x7f443311242c bp 0x7b43b7044f70 sp 0x7b43b7044f68
READ of size 8 at 0x7b73c90c1d48 thread T10 (Chrome_IOThread)
#0 content::BrowserChildProcessHost::FromID(int) content/browser/browser_child_process_host_impl.cc:142
#1 extensions::ProcessesTerminateFunction::GetProcessHandleOnIO(int) chrome/browser/extensions/api/processes/processes_api.cc:524
freed by thread T0 (chrome) here:
#0 operator delete(void*, unsigned long)
#1 std::__Cr::list<...>::remove(...) gen/third_party/libc++/src/include/__new/allocate.h:63
#2 content::BrowserChildProcessHostImpl::ForceShutdown() content/browser/browser_child_process_host_impl.cc:268
#3 content::GpuProcessHost::ValidateHost(content::GpuProcessHost*) content/browser/gpu/gpu_process_host.cc:1249
previously allocated by thread T0 (chrome) here:
#0 operator new(unsigned long)
#1 content::BrowserChildProcessHostImpl::BrowserChildProcessHostImpl(...)
SUMMARY: AddressSanitizer: heap-use-after-free content/browser/browser_child_process_host_impl.cc:142 in content::BrowserChildProcessHost::FromID(int)
MiraclePtr Status: NOT PROTECTED
Full ASAN log is in asan.log.
Credit
Please use c6eed09fc8b174b0f3eebedcceb1e792 as the credit for this vulnerability. Thank you.
Cross-thread use-after-free in the browser process via chrome.processes.terminate()
Context
The target is the Chrome browser process, specifically the chrome.processes extension API. That API lets an extension enumerate the browser's processes and act on them; chrome.processes.terminate() is the call that asks the browser to kill a process by its ID. The report covers a use-after-free (CVE-2026-87504) in the Core component, rated medium severity, disclosed on 2026-09-08 under the Chrome VRP with a bounty of 5000.00 USD.
The bug is a race between two threads. The extension API handler dispatches a lookup of the child process host to the IO thread, but the function it calls, BrowserChildProcessHost::FromID(), and the global g_child_process_list it walks are owned exclusively by the UI thread, with no synchronisation. The only guards are DCHECK_CURRENTLY_ON(BrowserThread::UI) assertions, which are compiled out in release builds. The result is a heap-use-after-free in the browser process. It affects all desktop platforms (Linux, macOS, Windows) and requires the processes extension permission, which the report says is currently gated to the dev channel.
Setup
The researcher tested at commit f7d73bbd27f24 on Linux x86_64 with the out/asan-release build configuration. The proof of concept is a Manifest V3 extension that enumerates non-renderer child processes through chrome.processes.getProcessInfo() and then fires concurrent terminate() calls to race the IO-thread lookup against UI-thread host destruction. The directory doubles as a loadable unpacked extension:
issue_processes_terminate_race_uaf/
├── manifest.json # MV3 extension manifest
├── background.js # PoC service worker
To make the race reliable, a 5ms sleep is inserted in BrowserChildProcessHost::FromID() to widen the race window. The PoC ships a patch.diff that applies this change, after which the browser is rebuilt.
Finding it
The researcher traced the path taken by ProcessesTerminateFunction::Run(). It handles two categories of process IDs. For renderer processes it resolves the handle synchronously on the UI thread via RenderProcessHost::FromID(). For non-renderer child processes (utility, GPU, etc.) it posts GetProcessHandleOnIO to the IO thread:
// chrome/browser/extensions/api/processes/processes_api.cc
content::GetIOThreadTaskRunner({})->PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(&ProcessesTerminateFunction::GetProcessHandleOnIO, this,
child_process_host_id_),
base::BindOnce(&ProcessesTerminateFunction::OnProcessHandleOnUI, this));
GetProcessHandleOnIO then calls BrowserChildProcessHost::FromID(), which iterates g_child_process_list:
// content/browser/browser_child_process_host_impl.cc
BrowserChildProcessHost* BrowserChildProcessHost::FromID(int child_process_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
BrowserChildProcessHostImpl::BrowserChildProcessList* process_list =
g_child_process_list.Pointer();
for (BrowserChildProcessHostImpl* host : *process_list) {
if (host->GetData().id == child_process_id)
return host;
}
return nullptr;
}
The DCHECK_CURRENTLY_ON(BrowserThread::UI) assertion is the only thing preventing cross-thread access here, and it vanishes in release builds. The list type is std::list<raw_ptr<BrowserChildProcessHostImpl, CtnExperimental>>, a plain doubly-linked list with no mutex, no lock and no sequence checker protecting it. That mismatch between the thread the lookup runs on and the thread that owns the list is the root of the race.
Exploitation
Step 1: Apply the widening patch and rebuild
cd ~/chromium/src
git apply issue_processes_terminate_race_uaf/patch.diff
autoninja -C out/asan-release chrome
This applies the 5ms sleep inside BrowserChildProcessHost::FromID() and builds the ASAN release configuration, widening the race window for reliable reproduction.
Step 2: Launch Chrome with the PoC extension loaded
ASAN_OPTIONS=detect_odr_violation=0 \
xvfb-run -a out/asan-release/chrome \
--disable-gpu \
--enable-experimental-extension-apis \
--load-extension=issue_processes_terminate_race_uaf \
--user-data-dir=/tmp/poc-$(date +%s) \
--no-first-run \
about:blank
--enable-experimental-extension-apis is passed on the command line. --load-extension loads the unpacked PoC directory, --disable-gpu and xvfb-run are part of the launch command. ASAN_OPTIONS=detect_odr_violation=0 is set for the run.
Step 3: Let the service worker race the two threads
The background service worker enumerates non-renderer child processes with chrome.processes.getProcessInfo() and then fires many terminate() calls at those IDs. Each call queues a GetProcessHandleOnIO task on the IO thread. The first successful termination kills a child process (for example the GPU process). The process exit triggers an IPC disconnect notification that propagates through the UI thread: OnChildDisconnected invokes the host delegate's destructor, which calls ForceShutdown():
// content/browser/browser_child_process_host_impl.cc
void BrowserChildProcessHostImpl::ForceShutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
g_child_process_list.Get().remove(this);
child_process_host_->ForceShutdown();
}
This std::list::remove unlinks and frees the list node on the UI thread. Meanwhile the IO thread is still processing queued FromID() calls, iterating the same list by following next pointers through heap-allocated std::list nodes. When it dereferences a node the UI thread has already freed, ASAN detects a heap-use-after-free.
Step 4: Observe the crash
The browser process crashes within seconds with a heap-use-after-free in BrowserChildProcessHost::FromID() on the IO thread, while the UI thread frees a list node via ForceShutdown():
==1272169==ERROR: AddressSanitizer: heap-use-after-free on address 0x7b73c90c1d48 at pc 0x7f443311242c bp 0x7b43b7044f70 sp 0x7b43b7044f68
READ of size 8 at 0x7b73c90c1d48 thread T10 (Chrome_IOThread)
#0 content::BrowserChildProcessHost::FromID(int) content/browser/browser_child_process_host_impl.cc:142
#1 extensions::ProcessesTerminateFunction::GetProcessHandleOnIO(int) chrome/browser/extensions/api/processes/processes_api.cc:524
freed by thread T0 (chrome) here:
#0 operator delete(void*, unsigned long)
#1 std::__Cr::list<...>::remove(...) gen/third_party/libc++/src/include/__new/allocate.h:63
#2 content::BrowserChildProcessHostImpl::ForceShutdown() content/browser/browser_child_process_host_impl.cc:268
#3 content::GpuProcessHost::ValidateHost(content::GpuProcessHost*) content/browser/gpu/gpu_process_host.cc:1249
previously allocated by thread T0 (chrome) here:
#0 operator new(unsigned long)
#1 content::BrowserChildProcessHostImpl::BrowserChildProcessHostImpl(...)
SUMMARY: AddressSanitizer: heap-use-after-free content/browser/browser_child_process_host_impl.cc:142 in content::BrowserChildProcessHost::FromID(int)
MiraclePtr Status: NOT PROTECTED
The stack shows the read on Chrome_IOThread in FromID() called from GetProcessHandleOnIO, and the free on the main thread in ForceShutdown() reached through GpuProcessHost::ValidateHost. The full ASAN log is in asan.log.
Root cause
The mistake is a thread-ownership violation. g_child_process_list and BrowserChildProcessHost::FromID() belong to the UI thread, and the only enforcement is a debug-only DCHECK_CURRENTLY_ON(BrowserThread::UI). In release builds that check does not exist, so the IO thread is free to walk the list while the UI thread mutates it. The list is a plain std::list with no mutex, no lock and no sequence checker, so nothing else stands in the way.
The freed 24-byte region is a std::list node containing the raw_ptr<BrowserChildProcessHostImpl> element plus the prev/next pointers. ASAN's additional information confirms "MiraclePtr Status: NOT PROTECTED" because the use-after-free is on the list node itself, not on a raw_ptr-managed object. MiraclePtr does not protect this access.
A contrasting example exists within the same class. BrowserChildProcessHostIterator, used by code that legitimately needs to enumerate child processes, enforces DCHECK_CURRENTLY_ON(BrowserThread::UI) and is only called from UI-thread code paths. The processes.terminate() handler is the sole caller that incorrectly dispatches FromID() to the IO thread.
The introducing commit is [redacted], dated 2016-03-11, authored by afakhry, reviewed at https://codereview.chromium.org/1584473004.
Impact
An extension holding the processes permission can crash the browser process by racing terminate() calls against child process teardown. The report describes the outcome as a heap-use-after-free in the browser process, confirmed by ASAN, and does not claim anything beyond that crash. The precondition is the processes extension permission, which the report says is currently gated to the dev channel, and the bug affects all desktop platforms (Linux, macOS, Windows). The severity is medium.
Fix
The report does not describe a fix. The change it implies is to stop dispatching BrowserChildProcessHost::FromID() to the IO thread from ProcessesTerminateFunction, so the lookup happens on the UI thread that owns g_child_process_list, or to give the list real synchronisation. The report does not say which was chosen.
Variants to test
- Other extension API handlers that post UI-thread-owned lookups to the IO thread. A positive result is an ASAN heap-use-after-free whose read stack is on
Chrome_IOThreadand whose free stack is on the main thread. - Other callers of
BrowserChildProcessHost::FromID()besidesProcessesTerminateFunction. A positive result is a caller whose stack does not begin on the UI thread. - Other global containers guarded only by
DCHECK_CURRENTLY_ON. A positive result is a release-build crash where the debug assertion would have fired. - Rapid repeated
terminate()calls against renderer process IDs, to check whether the synchronousRenderProcessHost::FromID()path has a similar race. A positive result is a use-after-free on the renderer path. - The same PoC on macOS and Windows builds. A positive result is the same ASAN report on those platforms.
What happened, in plain words
Chrome is not one program. When you open it, the browser starts several helper programs, called processes, that do different jobs: one draws the page, one handles graphics, one runs small utilities. The main program, the browser process, keeps a list of these helpers so it can talk to them and shut them down.
Chrome also lets extensions add features. An extension is a small program you install into the browser, and it talks to the browser through an API: a fixed set of commands the browser offers, like buttons on a control panel. One of those commands is chrome.processes.terminate(), which asks the browser to kill a process by its ID number.
This report is about a bug in that command. Chrome does its work on several threads. A thread is like a separate worker inside the same program; workers can run at the same time, and if two of them touch the same piece of memory without coordinating, things go wrong. The list of helper processes belongs to one worker, the UI thread (the one that handles the browser's windows and main logic). But when an extension calls terminate(), part of the lookup is handed to a different worker, the IO thread (the one that handles input and output, such as messages to and from other processes). That second worker reads the list while the first worker is changing it.
The result is a use-after-free. In plain terms: one worker frees a piece of memory (says "I am done with this, someone else may use it"), and the other worker then reads it as if it were still there. The memory may already belong to something else, so the read is meaningless at best and dangerous at worst. The report rates this medium severity, tracks it as CVE-2026-87504 in the Core component, and it was disclosed on 2026-09-08 under the Chrome VRP with a bounty of 5000.00 USD.
The bug affects all desktop platforms (Linux, macOS, Windows). It needs the processes extension permission, which the report says is currently gated to the dev channel, a less stable build of Chrome used for testing.
The pieces involved
Before the details, a few terms that come up constantly.
- Browser process: the main Chrome program. It owns the list of helper processes.
- Child process: a helper program started by the browser process, such as the GPU process that handles graphics.
- Renderer process: the helper that turns a web page into what you see. The report treats renderers separately from other children.
- Thread: a worker inside a program. Two threads can run at the same time, which is useful but requires care when they share data.
- Race condition: a bug where the result depends on which of two threads gets there first. Like two people reaching for the same door handle at once.
- Use-after-free: reading or writing memory after it has been released. Like reading a note after someone has thrown it away and the paper has been reused for something else.
- ASAN: AddressSanitizer, a tool built into a special test build of a program that watches memory and shouts when something reads freed memory.
- DCHECK: a check that only exists in debug builds. In release builds, the version shipped to users, it is compiled out, meaning it is simply not there.
The setup
The researcher tested at commit f7d73bbd27f24 on Linux x86_64 with the out/asan-release build configuration. A commit is a saved snapshot of the source code; the long string identifies exactly which one. The build configuration is a set of options used to compile Chrome, here a release build with ASAN enabled so memory errors are caught.
The proof of concept, the small program that demonstrates the bug, is a Manifest V3 extension. Manifest V3 is the current format for Chrome extensions; the manifest is the file that describes the extension. The extension first lists the non-renderer child processes with chrome.processes.getProcessInfo(), then fires many terminate() calls at once so the two threads collide. The folder is also a loadable unpacked extension, meaning Chrome can load it straight from a directory without packaging:
issue_processes_terminate_race_uaf/
├── manifest.json # MV3 extension manifest
├── background.js # PoC service worker
Line by line: the first line is the folder name. The second line is the manifest file, the extension's ID card. The third line is the background script, a service worker, which is code that runs in the background without a visible page. The comments after the # explain each file.
To make the race reliable, a 5ms sleep is inserted in BrowserChildProcessHost::FromID() to widen the race window. A race window is the short moment in which the two threads can collide; widening it makes the collision happen almost every time instead of rarely. The proof of concept ships a patch.diff, a file describing a small change to the source code, which applies this sleep; after that the browser is rebuilt.
Finding it
The researcher followed the path taken by ProcessesTerminateFunction::Run(), the function that handles a terminate() call. It deals with two kinds of process IDs. For renderer processes it looks up the handle straight away on the UI thread via RenderProcessHost::FromID(). For non-renderer child processes (utility, GPU and so on) it sends GetProcessHandleOnIO to the IO thread:
// chrome/browser/extensions/api/processes/processes_api.cc
content::GetIOThreadTaskRunner({})->PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(&ProcessesTerminateFunction::GetProcessHandleOnIO, this,
child_process_host_id_),
base::BindOnce(&ProcessesTerminateFunction::OnProcessHandleOnUI, this));
Line by line: the first line is a comment naming the source file. The second line asks for the IO thread's task runner, an object that can queue work to run on that thread. PostTaskAndReplyWithResult means: run this job on that thread, and when it finishes, run another job back on the original thread with the result. The next lines say which job to run, GetProcessHandleOnIO, passing the child process ID, and which job to run afterwards, OnProcessHandleOnUI. The this means the current object, so the jobs can use its data.
GetProcessHandleOnIO then calls BrowserChildProcessHost::FromID(), which walks the global list g_child_process_list:
// content/browser/browser_child_process_host_impl.cc
BrowserChildProcessHost* BrowserChildProcessHost::FromID(int child_process_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
BrowserChildProcessHostImpl::BrowserChildProcessList* process_list =
g_child_process_list.Pointer();
for (BrowserChildProcessHostImpl* host : *process_list) {
if (host->GetData().id == child_process_id)
return host;
}
return nullptr;
}
Line by line: the first line is a comment naming the file. The second line declares a function that takes a process ID and returns a pointer to a host object, or nothing. The third line is the debug-only check that the current thread is the UI thread. The next two lines fetch a pointer to the global list. The for loop then visits each host in the list. If a host's ID matches the requested one, it returns that host. If the loop ends without a match, it returns nullptr, meaning nothing.
The DCHECK_CURRENTLY_ON(BrowserThread::UI) assertion is the only thing preventing cross-thread access here, and it vanishes in release builds. The list type is std::list<raw_ptr<BrowserChildProcessHostImpl, CtnExperimental>>, a plain doubly-linked list with no mutex, no lock and no sequence checker protecting it. A doubly-linked list is a chain of nodes where each node points to the previous and the next one, like a paper chain. A mutex or lock is a way for threads to take turns; a sequence checker is a tool that records which thread is allowed to touch something. None of these are present. That mismatch between the thread the lookup runs on and the thread that owns the list is the root of the race.
Exploitation
Step 1: Apply the widening patch and rebuild
cd ~/chromium/src
git apply issue_processes_terminate_race_uaf/patch.diff
autoninja -C out/asan-release chrome
Line by line: cd ~/chromium/src moves into the folder holding the Chrome source code. git apply applies the patch file, which adds the 5ms sleep inside BrowserChildProcessHost::FromID(). autoninja builds Chrome using the out/asan-release configuration. The sleep widens the race window so the collision happens reliably, and the ASAN build reports the use-after-free.
Step 2: Launch Chrome with the PoC extension loaded
ASAN_OPTIONS=detect_odr_violation=0 \
xvfb-run -a out/asan-release/chrome \
--disable-gpu \
--enable-experimental-extension-apis \
--load-extension=issue_processes_terminate_race_uaf \
--user-data-dir=/tmp/poc-$(date +%s) \
--no-first-run \
about:blank
Line by line: ASAN_OPTIONS=detect_odr_violation=0 is set for the run. xvfb-run -a is part of the launch command. out/asan-release/chrome is the freshly built browser. --disable-gpu is passed on the command line. --enable-experimental-extension-apis is passed on the command line. --load-extension loads the unpacked proof-of-concept folder. --user-data-dir=/tmp/poc-$(date +%s) sets the profile folder for the run. --no-first-run and about:blank are part of the launch command.
Step 3: Let the service worker race the two threads
The background service worker lists the non-renderer child processes with chrome.processes.getProcessInfo() and then fires many terminate() calls at those IDs. Each call queues a GetProcessHandleOnIO task on the IO thread. The first successful termination kills a child process, for example the GPU process. The process exit triggers an IPC disconnect notification that travels through the UI thread. IPC means inter-process communication, the messaging system processes use to talk to each other. OnChildDisconnected then runs the host delegate's destructor, which calls ForceShutdown():
// content/browser/browser_child_process_host_impl.cc
void BrowserChildProcessHostImpl::ForceShutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
g_child_process_list.Get().remove(this);
child_process_host_->ForceShutdown();
}
The second line declares the shutdown function. The third line is again the debug-only UI-thread check. The fourth line removes this host from the global list; remove unlinks the node and frees it. The fifth line shuts down the underlying child process.
This std::list::remove unlinks and frees the list node on the UI thread. Meanwhile the IO thread is still working through queued FromID() calls, walking the same list by following next pointers through heap-allocated std::list nodes. The heap is the area of memory where a program stores things it creates while running. When the IO thread reads a node the UI thread has already freed, ASAN detects a heap-use-after-free.
Step 4: Observe the crash
The browser process crashes within seconds with a heap-use-after-free in BrowserChildProcessHost::FromID() on the IO thread, while the UI thread frees a list node via ForceShutdown():
==1272169==ERROR: AddressSanitizer: heap-use-after-free on address 0x7b73c90c1d48 at pc 0x7f443311242c bp 0x7b43b7044f70 sp 0x7b43b7044f68
READ of size 8 at 0x7b73c90c1d48 thread T10 (Chrome_IOThread)
#0 content::BrowserChildProcessHost::FromID(int) content/browser/browser_child_process_host_impl.cc:142
#1 extensions::ProcessesTerminateFunction::GetProcessHandleOnIO(int) chrome/browser/extensions/api/processes/processes_api.cc:524
freed by thread T0 (chrome) here:
#0 operator delete(void*, unsigned long)
#1 std::__Cr::list<...>::remove(...) gen/third_party/libc++/src/include/__new/allocate.h:63
#2 content::BrowserChildProcessHostImpl::ForceShutdown() content/browser/browser_child_process_host_impl.cc:268
#3 content::GpuProcessHost::ValidateHost(content::GpuProcessHost*) content/browser/gpu/gpu_process_host.cc:1249
previously allocated by thread T0 (chrome) here:
#0 operator new(unsigned long)
#1 content::BrowserChildProcessHostImpl::BrowserChildProcessHostImpl(...)
SUMMARY: AddressSanitizer: heap-use-after-free content/browser/browser_child_process_host_impl.cc:142 in content::BrowserChildProcessHost::FromID(int)
MiraclePtr Status: NOT PROTECTED
Line by line: the first line is ASAN announcing a heap-use-after-free at a memory address. The second line says a read of 8 bytes happened on thread T10, the IO thread. The next two lines are the stack, the list of function calls that led to the read: FromID() was called from GetProcessHandleOnIO. The block starting freed by thread T0 shows where the memory was released: operator delete was called from std::list::remove, reached through ForceShutdown() and GpuProcessHost::ValidateHost. The block starting previously allocated shows where the memory originally came from: operator new in the host constructor. The SUMMARY line repeats the verdict. The last line says MiraclePtr, a Chrome defence that protects certain pointers, did not protect this one.
The stack shows the read on Chrome_IOThread in FromID() called from GetProcessHandleOnIO, and the free on the main thread in ForceShutdown() reached through GpuProcessHost::ValidateHost. The full ASAN log is in asan.log.
Root cause
The mistake is a thread-ownership violation: code that belongs to one thread is used from another. g_child_process_list and BrowserChildProcessHost::FromID() belong to the UI thread, and the only enforcement is a debug-only DCHECK_CURRENTLY_ON(BrowserThread::UI). In release builds that check does not exist, so the IO thread is free to walk the list while the UI thread changes it. The list is a plain std::list with no mutex, no lock and no sequence checker, so nothing else stands in the way.
The freed 24-byte region is a std::list node containing the raw_ptr<BrowserChildProcessHostImpl> element plus the prev/next pointers. ASAN's additional information confirms "MiraclePtr Status: NOT PROTECTED" because the use-after-free is on the list node itself, not on a raw_ptr-managed object. MiraclePtr does not protect this access.
A contrasting example exists within the same class. BrowserChildProcessHostIterator, used by code that legitimately needs to list child processes, enforces DCHECK_CURRENTLY_ON(BrowserThread::UI) and is only called from UI-thread code paths. The processes.terminate() handler is the sole caller that incorrectly sends FromID() to the IO thread.
The introducing commit is [redacted], dated 2016-03-11, authored by afakhry, reviewed at https://codereview.chromium.org/1584473004.
Impact
An extension holding the processes permission can crash the browser process by racing terminate() calls against child process teardown. The report describes the outcome as a heap-use-after-free in the browser process, confirmed by ASAN, and does not claim anything beyond that crash. The precondition is the processes extension permission, which the report says is currently gated to the dev channel, and the bug affects all desktop platforms (Linux, macOS, Windows). The severity is medium.
Fix
The report does not describe a fix. The change it implies is to stop sending BrowserChildProcessHost::FromID() to the IO thread from ProcessesTerminateFunction, so the lookup happens on the UI thread that owns g_child_process_list, or to give the list real synchronisation. The report does not say which was chosen.
Variants to test
- Other extension API handlers that post UI-thread-owned lookups to the IO thread. A positive result is an ASAN heap-use-after-free whose read stack is on
Chrome_IOThreadand whose free stack is on the main thread. - Other callers of
BrowserChildProcessHost::FromID()besidesProcessesTerminateFunction. A positive result is a caller whose stack does not begin on the UI thread. - Other global containers guarded only by
DCHECK_CURRENTLY_ON. A positive result is a release-build crash where the debug assertion would have fired. - Rapid repeated
terminate()calls against renderer process IDs, to check whether the synchronousRenderProcessHost::FromID()path has a similar race. A positive result is a use-after-free on the renderer path. - The same PoC on macOS and Windows builds. A positive result is the same ASAN report on those platforms.
Glossary
- API: a fixed set of commands one program offers to another, like buttons on a control panel.
- ASAN (AddressSanitizer): a tool in a special test build that detects memory errors such as reading freed memory.
- Browser process: the main Chrome program that coordinates all the helper processes.
- Child process: a helper program started by the browser process, such as the GPU process.
- Commit: a saved snapshot of source code, identified by a long string.
- CVE: a public identifier for a known security vulnerability.
- DCHECK: a check that exists only in debug builds and is removed from release builds.
- Doubly-linked list: a chain of nodes where each node points to the previous and next one.
- Extension: a small program installed into the browser that adds features.
- Heap: the area of memory where a program stores things it creates while running.
- Heap-use-after-free: reading or writing heap memory after it has been released.
- IO thread: the worker inside Chrome that handles input and output, such as messages to and from other processes.
- IPC: inter-process communication, the messaging system processes use to talk to each other.
- Lock / mutex: a mechanism that makes threads take turns when sharing data.
- Manifest V3: the current format for Chrome extensions, described by a manifest file.
- MiraclePtr: a Chrome defence that protects certain pointers from being misused after free.
- Patch: a file describing a small change to source code.
- Permission: a capability an extension must be granted to use, such as
processes. - Race condition: a bug where the result depends on which of two threads acts first.
- Sequence checker: a tool that records which thread is allowed to touch a piece of data.
- Service worker: background code in an extension that runs without a visible page.
- Stack: the list of function calls that led to a particular point in a program.
- Thread: a worker inside a program; several can run at the same time.
- UI thread: the worker inside Chrome that handles windows and main browser logic.
- VRP: Chrome's Vulnerability Reward Program, which pays for security reports.