Use after free in Navigation (CVE-2026-17657)
A use-after-free exists in the browser process navigation commit path when restoring a page from the back-forward cache. A compromised renderer can trigger it by breaking its PageBroadcast endpoint before the page is cached, then causing a history traversal that restores the page, crashing the browser.
c6eed09fc8b174b0f3eebedcceb1e792 Follow
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
Reentrant Resume During BFCache Restore Causes Browser-Process Use-After-Free in CommitDeferringConditionRunner
Summary
A use-after-free vulnerability exists in the browser process navigation commit path on all desktop platforms (Linux, Windows, macOS, ChromeOS). When restoring a page from the back-forward cache, CommitDeferringConditionRunner::ProcessConditions caches a raw pointer to the current CommitDeferringCondition before calling its WillCommitNavigation method. If the associated PageBroadcast Mojo endpoint is in an error state, the lifecycle update sent during the BFCache restore preparation fails synchronously, triggering a chain of destructor callbacks that reentrantly invoke ResumeProcessing, which erases and destroys the condition object. When WillCommitNavigation returns, the caller dereferences the now-dangling pointer, producing a heap-use-after-free on the browser UI thread. A compromised renderer can reliably trigger this by closing its PageBroadcast associated receiver before the page enters the cache, then initiating a history traversal to restore it.
Bisect
Introducing Commit: f2691ec93da53271ffe2726bf923e0ad7206922e
- Date: 2024-10-03
- Author: Lingqi Chi
- Review: https://chromium-review.googlesource.com/c/chromium/src/+/5884681
This commit added condition->TraceEventName() usage in the kDefer case of ProcessConditions, creating the dangling-pointer dereference site. The underlying reentrant-resume hazard has existed since CommitDeferringConditionRunner was introduced in 1bdb3701f9ae1 (2021-04-30, https://chromium-review.googlesource.com/c/chromium/src/+/2716161), but the dereference after the WillCommitNavigation call was not present until the tracing commit.
Root Cause
CommitDeferringConditionRunner::ProcessConditions iterates a vector of conditions and, for each one, extracts a raw pointer before invoking the condition's WillCommitNavigation method:
// content/browser/renderer_host/commit_deferring_condition_runner.cc
CommitDeferringCondition* condition = (*conditions_.begin()).get();
is_deferred_ = false;
switch (condition->WillCommitNavigation(std::move(resume_closure))) {
case CommitDeferringCondition::Result::kDefer:
is_deferred_ = true;
TRACE_EVENT_BEGIN("navigation",
perfetto::DynamicString(condition->TraceEventName()),
perfetto::Track::FromPointer(this));
return;
The code assumes that when WillCommitNavigation returns kDefer, the resume_closure will only be called asynchronously. The corresponding ResumeProcessing method erases the front condition and recurses into ProcessConditions:
// content/browser/renderer_host/commit_deferring_condition_runner.cc
void CommitDeferringConditionRunner::ResumeProcessing() {
DCHECK(is_deferred_);
is_deferred_ = false;
DCHECK(!conditions_.empty());
conditions_.erase(conditions_.begin());
ProcessConditions();
}
For back-forward cache restores, BackForwardCacheCommitDeferringCondition::WillCommitNavigation passes the resume closure into BackForwardCacheImpl::WillCommitNavigationToCachedEntry, which wraps it in a BarrierClosure and distributes partial closures to each RenderViewHost via PrepareToLeaveBackForwardCache:
// content/browser/renderer_host/back_forward_cache_impl.cc
auto cb = base::BarrierClosure(
bfcache_entry.render_view_hosts().size(),
base::BindOnce([](base::OnceClosure cb) { std::move(cb).Run(); },
std::move(done_callback)));
for (const auto& rvh : bfcache_entry.render_view_hosts()) {
rvh->PrepareToLeaveBackForwardCache(cb);
}
Each RenderViewHostImpl::PrepareToLeaveBackForwardCache wraps its closure in mojo::WrapCallbackWithDefaultInvokeIfNotRun to guarantee execution even on failure, then passes it through PageLifecycleStateManager::SendUpdatesToRendererIfNeeded, which sends SetPageLifecycleState on the PageBroadcast associated remote:
// content/browser/renderer_host/render_view_host_impl.cc
page_lifecycle_state_manager_->SetIsLeavingBackForwardCache(
mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(done_cb)));
// content/browser/renderer_host/page_lifecycle_state_manager.cc
render_view_host_impl_->GetAssociatedPageBroadcast()->SetPageLifecycleState(
std::move(state), std::move(page_restore_params),
base::BindOnce(&PageLifecycleStateManager::OnSetPageLifecycleStateResponse,
weak_ptr_factory_.GetWeakPtr(), std::move(new_state),
std::move(done_cb)));
When the PageBroadcast endpoint is in an error state, InterfaceEndpointClient::SendMessageWithResponder returns false without storing the responder. The responder, a unique_ptr<MessageReceiver> local to the function, is destroyed at function exit. Its destructor chain reaches the CallbackWithDeleteHelper installed by WrapCallbackWithDefaultInvokeIfNotRun, which synchronously invokes the default callback. This fires the barrier closure, which calls the resume closure, which reenters ResumeProcessing and erases the condition from the vector, all within the original WillCommitNavigation call stack.
// mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
if (encountered_error_) {
message->NotifyPeerClosureForSerializedHandles(handle_.group_controller());
return false;
// responder (unique_ptr) destroyed here -> ~CallbackWithDeleteHelper
// -> barrier closure -> resume -> conditions_.erase(begin())
}
After WillCommitNavigation returns kDefer, the outer ProcessConditions dereferences the cached condition pointer, which now points to freed memory.
A compromised renderer triggers this by resetting its PageBroadcast associated receiver after the BFCache lifecycle acknowledgment has been sent. Since RenderViewHostImpl::BindPageBroadcast installs no disconnect handler on the browser-side remote, the page remains in the cache with a silently broken endpoint. A subsequent history.back() from any page restores the cached entry and hits the vulnerable path.
Reproduce
Tested at commit 123ee915f2e081733b59fad9eeb7c59e899597c4 on Linux x86_64 with an ASAN-enabled release build (is_asan = true, is_debug = false).
A renderer-side patch is required to simulate the compromised renderer closing the PageBroadcast receiver upon BFCache entry. Apply patch.diff before building. The patch modifies only renderer-process code (WebViewImpl::SetPageLifecycleState), adding a receiver_.reset() call after the BFCache lifecycle acknowledgment is sent.
Start the included HTTP server and launch Chrome:
python3 issue_bfcache_commit_defer_uaf/server.py &
ASAN_OPTIONS=detect_odr_violation=0 xvfb-run -a out/asan-release/chrome \
--user-data-dir=/tmp/poc-bfcache-uaf \
http://localhost:8765/page1.html
Page 1 automatically navigates to page 2 after one second (entering the back-forward cache). Page 2 calls history.back() after two seconds, restoring page 1. The browser process crashes with a heap-use-after-free within approximately four seconds. No user interaction is required.
==13056==ERROR: AddressSanitizer: heap-use-after-free on address 0x7b7d595cc658 at pc 0x7f3dbf9b442f bp 0x7ffc1605b590 sp 0x7ffc1605b588
READ of size 8 at 0x7b7d595cc658 thread T0 (chrome)
#0 0x7f3dbf9b442e in content::BackForwardCacheImpl::WillCommitNavigationToCachedEntry(content::BackForwardCacheImpl::Entry&, base::OnceCallback<void ()>) gen/third_party/libc++/src/include/__tree:208:12
#1 0x7f3dbf9a2a0d in content::BackForwardCacheCommitDeferringCondition::WillCommitNavigation(base::OnceCallback<void ()>) content/browser/renderer_host/back_forward_cache_commit_deferring_condition.cc:65:11
#2 0x7f3dbfa14e8a in content::CommitDeferringConditionRunner::ProcessConditions() content/browser/renderer_host/commit_deferring_condition_runner.cc:219:24
#3 0x7f3dbfcae89e in content::NavigationRequest::RunCommitDeferringConditions(base::OnceCallback<void ()>) content/browser/renderer_host/navigation_request.cc:6507:21
#4 0x7f3dbfce327c in content::NavigationRequest::OnWillProcessResponseChecksComplete(content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:6422:3
#5 0x7f3dbfcfa969 in content::NavigationRequest::OnWillProcessResponseProcessed(content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:8351:3
#6 0x7f3dbfcf9001 in content::NavigationRequest::OnNavigationEventProcessed(content::NavigationThrottleEvent, content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:8246:7
#7 0x7f3dbfd5f468 in content::NavigationThrottleRegistryImpl::OnEventProcessed(content::NavigationThrottleEvent, content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_throttle_registry_impl.cc:321:24
#8 0x7f3dbfd64b1d in content::NavigationThrottleRunner::InformRegistry(content::NavigationThrottle::ThrottleCheckResult const&) content/browser/renderer_host/navigation_throttle_runner.cc:249:14
#9 0x7f3dbfd637b0 in content::NavigationThrottleRunner::ProcessInternal() content/browser/renderer_host/navigation_throttle_runner.cc:238:3
#10 0x7f3dbfd61afa in content::NavigationThrottleRunner::ProcessNavigationEvent(content::NavigationThrottleEvent) content/browser/renderer_host/navigation_throttle_runner.cc:131:3
#11 0x7f3dbfd5cfdf in content::NavigationThrottleRegistryImpl::ProcessNavigationEvent(content::NavigationThrottleEvent) content/browser/renderer_host/navigation_throttle_registry_impl.cc:219:32
#12 0x7f3dbfcd21bd in content::NavigationRequest::WillProcessResponse() content/browser/renderer_host/navigation_request.cc:8617:23
#13 0x7f3dbfccf8c0 in content::NavigationRequest::SelectFrameHostForOnResponseStarted(...) content/browser/renderer_host/navigation_request.cc:5271:3
0x7b7d595cc658 is located 8 bytes inside of 48-byte region [0x7b7d595cc650,0x7b7d595cc680)
freed by thread T0 (chrome) here:
#0 0x55cf8d2b1842 in operator delete(void*, unsigned long)
#1 0x7f3dbff5047f in std::__Cr::__tree<...RenderViewHostImpl...>::__tree_deleter::operator()(...) gen/third_party/libc++/src/include/__new/allocate.h:63:10
#2 0x7f3dbff14316 in content::RenderFrameHostManager::CommitPending(...) gen/third_party/libc++/src/include/__tree:1361:64
...
#11 0x7f3dbfcead80 in content::NavigationRequest::OnCommitDeferringConditionChecksComplete(...) base/functional/callback.h:155:12
#12 0x7f3dbfa15237 in content::CommitDeferringConditionRunner::ProcessConditions() content/browser/renderer_host/commit_deferring_condition_runner.cc:246:14
#13 0x7f3dbfa15dfa in content::CommitDeferringConditionRunner::ResumeProcessing() content/browser/renderer_host/commit_deferring_condition_runner.cc:104:3
...
#16 0x7f3ddcf744c0 in base::(anonymous namespace)::BarrierInfo::Run() base/functional/callback.h:155:12
...
#20 0x7f3dbe8f6ecd in mojo::internal::CallbackWithDeleteHelper<void ()>::~CallbackWithDeleteHelper() base/functional/callback.h:155:12
...
#24 0x7f3ddddfe03a in mojo::InterfaceEndpointClient::SendMessageWithResponder(...) gen/third_party/libc++/src/include/__memory/unique_ptr.h:74:5
#26 0x7f3dd15f2c64 in blink::mojom::PageBroadcastProxy::SetPageLifecycleState(...) gen/third_party/blink/public/mojom/page/page.mojom.cc:668:3
#27 0x7f3dbfd92dc9 in content::PageLifecycleStateManager::SendUpdatesToRendererIfNeeded(...) content/browser/renderer_host/page_lifecycle_state_manager.cc:238:57
#28 0x7f3dbfd95a80 in content::PageLifecycleStateManager::SetIsLeavingBackForwardCache(...) content/browser/renderer_host/page_lifecycle_state_manager.cc:200:3
#29 0x7f3dc00121cc in content::RenderViewHostImpl::PrepareToLeaveBackForwardCache(...) content/browser/renderer_host/render_view_host_impl.cc:677:34
SUMMARY: AddressSanitizer: heap-use-after-free gen/third_party/libc++/src/include/__tree:208:12 in content::BackForwardCacheImpl::WillCommitNavigationToCachedEntry(content::BackForwardCacheImpl::Entry&, base::OnceCallback<void ()>)
Credit
Please use c6eed09fc8b174b0f3eebedcceb1e792 as the credit for this vulnerability. Thank you.
Context
This report describes a use-after-free in the browser process navigation commit path of Google Chrome, tracked as CVE-2026-17657 and filed through the Chrome VRP. The affected component is Navigation, and the specific code is CommitDeferringConditionRunner, which sits between a navigation request and the point where a response is committed.
Commit deferring conditions are a mechanism that lets the browser pause a navigation just before commit. A condition's WillCommitNavigation method can return kDefer, in which case the runner stores a resume closure and waits. When the condition is finished, it calls the resume closure, and ResumeProcessing removes the condition from the queue and continues with the next one.
The feature involved in the trigger is the back-forward cache (BFCache). When a page is restored from the cache, BackForwardCacheCommitDeferringCondition defers the commit while the browser tells each RenderViewHost to leave the cache. That notification is sent to the renderer as SetPageLifecycleState over a PageBroadcast Mojo associated remote.
The report states the bug affects all desktop platforms: Linux, Windows, macOS and ChromeOS. The researcher is credited as [redacted], the severity is high, and the bounty was 36,000 USD. The report does not give a CVSS score.
Setup
The reproduction was tested at commit [redacted] on Linux x86_64, using an ASAN-enabled release build with is_asan = true and is_debug = false.
A renderer-side patch is required. The report says the patch is called patch.diff and must be applied before building. It modifies only renderer-process code, specifically WebViewImpl::SetPageLifecycleState, and adds a receiver_.reset() call after the BFCache lifecycle acknowledgment has been sent. This simulates a compromised renderer that closes its PageBroadcast receiver on entering the cache.
The report also includes an HTTP server and a page, page1.html, served on port 8765. No accounts or roles are involved. The precondition is a renderer that can reset its PageBroadcast associated receiver after the BFCache lifecycle acknowledgment has been sent, which the report frames as something a compromised renderer can do.
Finding it
The researcher identified a reentrancy hazard in CommitDeferringConditionRunner::ProcessConditions. The method takes a raw pointer to the current condition before calling WillCommitNavigation, and it assumes that when the method returns kDefer, the resume closure will only run asynchronously. If the closure runs synchronously inside the call, ResumeProcessing erases and destroys the condition while the outer frame still holds the pointer.
The BFCache restore path makes that synchronous execution possible. The resume closure is wrapped in a BarrierClosure and distributed to each RenderViewHost. Each partial closure is wrapped with mojo::WrapCallbackWithDefaultInvokeIfNotRun, so it is guaranteed to run even if the Mojo send fails. When the PageBroadcast endpoint is already in an error state, the send fails synchronously, the responder is destroyed, and the default callback fires the barrier, which fires the resume closure, which reenters ResumeProcessing.
A bisect attributes the dereference site to commit [redacted], dated 2024-10-03, authored by Lingqi Chi, reviewed at https://chromium-review.googlesource.com/c/chromium/src/+/5884681. That commit added the condition->TraceEventName() usage in the kDefer case of ProcessConditions, which is the dangling-pointer dereference site. The report notes that the underlying reentrant-resume hazard has existed since CommitDeferringConditionRunner was introduced in 1bdb3701f9ae1 on 2021-04-30 (https://chromium-review.googlesource.com/c/chromium/src/+/2716161), but the dereference after the WillCommitNavigation call was not present until the tracing commit.
Exploitation
Step 1: Build with the renderer patch
Apply patch.diff and build an ASAN release configuration. The patch adds receiver_.reset() in WebViewImpl::SetPageLifecycleState after the BFCache lifecycle acknowledgment is sent, simulating a compromised renderer that closes its PageBroadcast receiver on entering the cache.
Step 2: Start the server and launch Chrome
python3 issue_bfcache_commit_defer_uaf/server.py &
ASAN_OPTIONS=detect_odr_violation=0 xvfb-run -a out/asan-release/chrome \
--user-data-dir=/tmp/poc-bfcache-uaf \
http://localhost:8765/page1.html
The first command starts the included HTTP server in the background. The second launches the ASAN build under xvfb-run, with a dedicated user data directory, and opens page1.html. The command sets ASAN_OPTIONS=detect_odr_violation=0; the report does not explain why.
Step 3: Let the pages drive the navigation
Page 1 automatically navigates to page 2 after one second, which puts page 1 into the back-forward cache. Page 2 calls history.back() after two seconds, restoring page 1. No user interaction is required. The browser process crashes with a heap-use-after-free within approximately four seconds.
Step 4: Read the ASAN report
==13056==ERROR: AddressSanitizer: heap-use-after-free on address 0x7b7d595cc658 at pc 0x7f3dbf9b442f bp 0x7ffc1605b590 sp 0x7ffc1605b588
READ of size 8 at 0x7b7d595cc658 thread T0 (chrome)
#0 0x7f3dbf9b442e in content::BackForwardCacheImpl::WillCommitNavigationToCachedEntry(content::BackForwardCacheImpl::Entry&, base::OnceCallback<void ()>) gen/third_party/libc++/src/include/__tree:208:12
#1 0x7f3dbf9a2a0d in content::BackForwardCacheCommitDeferringCondition::WillCommitNavigation(base::OnceCallback<void ()>) content/browser/renderer_host/back_forward_cache_commit_deferring_condition.cc:65:11
#2 0x7f3dbfa14e8a in content::CommitDeferringConditionRunner::ProcessConditions() content/browser/renderer_host/commit_deferring_condition_runner.cc:219:24
#3 0x7f3dbfcae89e in content::NavigationRequest::RunCommitDeferringConditions(base::OnceCallback<void ()>) content/browser/renderer_host/navigation_request.cc:6507:21
#4 0x7f3dbfce327c in content::NavigationRequest::OnWillProcessResponseChecksComplete(content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:6422:3
#5 0x7f3dbfcfa969 in content::NavigationRequest::OnWillProcessResponseProcessed(content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:8351:3
#6 0x7f3dbfcf9001 in content::NavigationRequest::OnNavigationEventProcessed(content::NavigationThrottleEvent, content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:8246:7
#7 0x7f3dbfd5f468 in content::NavigationThrottleRegistryImpl::OnEventProcessed(content::NavigationThrottleEvent, content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_throttle_registry_impl.cc:321:24
#8 0x7f3dbfd64b1d in content::NavigationThrottleRunner::InformRegistry(content::NavigationThrottle::ThrottleCheckResult const&) content/browser/renderer_host/navigation_throttle_runner.cc:249:14
#9 0x7f3dbfd637b0 in content::NavigationThrottleRunner::ProcessInternal() content/browser/renderer_host/navigation_throttle_runner.cc:238:3
#10 0x7f3dbfd61afa in content::NavigationThrottleRunner::ProcessNavigationEvent(content::NavigationThrottleEvent) content/browser/renderer_host/navigation_throttle_runner.cc:131:3
#11 0x7f3dbfd5cfdf in content::NavigationThrottleRegistryImpl::ProcessNavigationEvent(content::NavigationThrottleEvent) content/browser/renderer_host/navigation_throttle_registry_impl.cc:219:32
#12 0x7f3dbfcd21bd in content::NavigationRequest::WillProcessResponse() content/browser/renderer_host/navigation_request.cc:8617:23
#13 0x7f3dbfccf8c0 in content::NavigationRequest::SelectFrameHostForOnResponseStarted(...) content/browser/renderer_host/navigation_request.cc:5271:3
0x7b7d595cc658 is located 8 bytes inside of 48-byte region [0x7b7d595cc650,0x7b7d595cc680)
freed by thread T0 (chrome) here:
#0 0x55cf8d2b1842 in operator delete(void*, unsigned long)
#1 0x7f3dbff5047f in std::__Cr::__tree<...RenderViewHostImpl...>::__tree_deleter::operator()(...) gen/third_party/libc++/src/include/__new/allocate.h:63:10
#2 0x7f3dbff14316 in content::RenderFrameHostManager::CommitPending(...) gen/third_party/libc++/src/include/__tree:1361:64
...
#11 0x7f3dbfcead80 in content::NavigationRequest::OnCommitDeferringConditionChecksComplete(...) base/functional/callback.h:155:12
#12 0x7f3dbfa15237 in content::CommitDeferringConditionRunner::ProcessConditions() content/browser/renderer_host/commit_deferring_condition_runner.cc:246:14
#13 0x7f3dbfa15dfa in content::CommitDeferringConditionRunner::ResumeProcessing() content/browser/renderer_host/commit_deferring_condition_runner.cc:104:3
...
#16 0x7f3ddcf744c0 in base::(anonymous namespace)::BarrierInfo::Run() base/functional/callback.h:155:12
...
#20 0x7f3dbe8f6ecd in mojo::internal::CallbackWithDeleteHelper<void ()>::~CallbackWithDeleteHelper() base/functional/callback.h:155:12
...
#24 0x7f3ddddfe03a in mojo::InterfaceEndpointClient::SendMessageWithResponder(...) gen/third_party/libc++/src/include/__memory/unique_ptr.h:74:5
#26 0x7f3dd15f2c64 in blink::mojom::PageBroadcastProxy::SetPageLifecycleState(...) gen/third_party/blink/public/mojom/page/page.mojom.cc:668:3
#27 0x7f3dbfd92dc9 in content::PageLifecycleStateManager::SendUpdatesToRendererIfNeeded(...) content/browser/renderer_host/page_lifecycle_state_manager.cc:238:57
#28 0x7f3dbfd95a80 in content::PageLifecycleStateManager::SetIsLeavingBackForwardCache(...) content/browser/renderer_host/page_lifecycle_state_manager.cc:200:3
#29 0x7f3dc00121cc in content::RenderViewHostImpl::PrepareToLeaveBackForwardCache(...) content/browser/renderer_host/render_view_host_impl.cc:677:34
SUMMARY: AddressSanitizer: heap-use-after-free gen/third_party/libc++/src/include/__tree:208:12 in content::BackForwardCacheImpl::WillCommitNavigationToCachedEntry(content::BackForwardCacheImpl::Entry&, base::OnceCallback<void ()>)
The read happens on thread T0, the browser UI thread, and is 8 bytes wide. The freed region is 48 bytes, and the read is 8 bytes inside it. The free stack shows the destruction path: InterfaceEndpointClient::SendMessageWithResponder destroys the responder, CallbackWithDeleteHelper runs the default callback, BarrierInfo::Run fires the barrier, ResumeProcessing erases the condition, and ProcessConditions continues into OnCommitDeferringConditionChecksComplete. The first stack shows the read in BackForwardCacheImpl::WillCommitNavigationToCachedEntry, reached through BackForwardCacheCommitDeferringCondition::WillCommitNavigation and CommitDeferringConditionRunner::ProcessConditions.
Root cause
CommitDeferringConditionRunner::ProcessConditions iterates a vector of conditions and extracts a raw pointer before invoking WillCommitNavigation:
// content/browser/renderer_host/commit_deferring_condition_runner.cc
CommitDeferringCondition* condition = (*conditions_.begin()).get();
is_deferred_ = false;
switch (condition->WillCommitNavigation(std::move(resume_closure))) {
case CommitDeferringCondition::Result::kDefer:
is_deferred_ = true;
TRACE_EVENT_BEGIN("navigation",
perfetto::DynamicString(condition->TraceEventName()),
perfetto::Track::FromPointer(this));
return;
The code assumes that when WillCommitNavigation returns kDefer, the resume_closure will only be called asynchronously. ResumeProcessing erases the front condition and recurses into ProcessConditions:
// content/browser/renderer_host/commit_deferring_condition_runner.cc
void CommitDeferringConditionRunner::ResumeProcessing() {
DCHECK(is_deferred_);
is_deferred_ = false;
DCHECK(!conditions_.empty());
conditions_.erase(conditions_.begin());
ProcessConditions();
}
For BFCache restores, BackForwardCacheCommitDeferringCondition::WillCommitNavigation passes the resume closure into BackForwardCacheImpl::WillCommitNavigationToCachedEntry, which wraps it in a BarrierClosure and distributes partial closures to each RenderViewHost via PrepareToLeaveBackForwardCache:
// content/browser/renderer_host/back_forward_cache_impl.cc
auto cb = base::BarrierClosure(
bfcache_entry.render_view_hosts().size(),
base::BindOnce([](base::OnceClosure cb) { std::move(cb).Run(); },
std::move(done_callback)));
for (const auto& rvh : bfcache_entry.render_view_hosts()) {
rvh->PrepareToLeaveBackForwardCache(cb);
}
Each RenderViewHostImpl::PrepareToLeaveBackForwardCache wraps its closure in mojo::WrapCallbackWithDefaultInvokeIfNotRun to guarantee execution even on failure, then passes it through PageLifecycleStateManager::SendUpdatesToRendererIfNeeded, which sends SetPageLifecycleState on the PageBroadcast associated remote:
// content/browser/renderer_host/render_view_host_impl.cc
page_lifecycle_state_manager_->SetIsLeavingBackForwardCache(
mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(done_cb)));
// content/browser/renderer_host/page_lifecycle_state_manager.cc
render_view_host_impl_->GetAssociatedPageBroadcast()->SetPageLifecycleState(
std::move(state), std::move(page_restore_params),
base::BindOnce(&PageLifecycleStateManager::OnSetPageLifecycleStateResponse,
weak_ptr_factory_.GetWeakPtr(), std::move(new_state),
std::move(done_cb)));
When the PageBroadcast endpoint is in an error state, InterfaceEndpointClient::SendMessageWithResponder returns false without storing the responder. The responder, a unique_ptr<MessageReceiver> local to the function, is destroyed at function exit. Its destructor chain reaches the CallbackWithDeleteHelper installed by WrapCallbackWithDefaultInvokeIfNotRun, which synchronously invokes the default callback. That fires the barrier closure, which calls the resume closure, which reenters ResumeProcessing and erases the condition from the vector, all within the original WillCommitNavigation call stack:
// mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
if (encountered_error_) {
message->NotifyPeerClosureForSerializedHandles(handle_.group_controller());
return false;
// responder (unique_ptr) destroyed here -> ~CallbackWithDeleteHelper
// -> barrier closure -> resume -> conditions_.erase(begin())
}
After WillCommitNavigation returns kDefer, the outer ProcessConditions dereferences the cached condition pointer, which now points to freed memory. The dereference in the report is the condition->TraceEventName() call added by the tracing commit.
A compromised renderer triggers this by resetting its PageBroadcast associated receiver after the BFCache lifecycle acknowledgment has been sent. RenderViewHostImpl::BindPageBroadcast installs no disconnect handler on the browser-side remote, so the page remains in the cache with a silently broken endpoint. A subsequent history.back() from any page restores the cached entry and hits the vulnerable path.
The DCHECK(is_deferred_) and DCHECK(!conditions_.empty()) in ResumeProcessing are debug assertions; the report does not discuss them as defences. The WrapCallbackWithDefaultInvokeIfNotRun wrapper, which exists to guarantee the callback runs on failure, is precisely what makes the failure synchronous.
Impact
The crash is a heap-use-after-free on the browser UI thread, which is the browser process. The report describes the trigger as available to a compromised renderer, and the reproduction requires a renderer-side patch to simulate that condition. It states that no user interaction is required once the renderer behaves as described, and that the crash occurs within approximately four seconds.
The severity is high and the bounty was 36,000 USD.
Fix
A fix would need to ensure that the condition pointer is not used after WillCommitNavigation returns if the resume closure may have run synchronously, for example by re-checking the condition's presence in the vector or by not caching a raw pointer across the call.
Variants to test
The following are concrete things to try on other targets, based on the mechanisms in the report. Each is a hypothesis, not a claim from the original.
- Other commit deferring conditions that can complete synchronously. Look for conditions whose
WillCommitNavigationcan invoke the resume closure before returning, for example through a Mojo send that fails on an errored endpoint. A positive result is an ASAN heap-use-after-free inProcessConditionsafter theWillCommitNavigationcall. - Other uses of
mojo::WrapCallbackWithDefaultInvokeIfNotRunin navigation paths. If the default callback can run synchronously and reenter a caller that holds a raw pointer, the same pattern applies. A positive result is a crash whose free stack passes throughCallbackWithDeleteHelperand whose read stack is in the outer caller. - Other associated remotes without disconnect handlers.
RenderViewHostImpl::BindPageBroadcastinstalls none according to the report, so the page stays in the cache with a broken endpoint. Check other browser-side remotes bound to renderer-controlled receivers for the same gap. A positive result is a cached or live object whose endpoint is in an error state while the browser still treats it as usable. - Other reentrant resume paths in
CommitDeferringConditionRunner. Any condition that can call its resume closure synchronously, not only the BFCache condition, would hit the same erase-during-iteration problem. A positive result is aconditions_.erase(conditions_.begin())in the free stack beneath theWillCommitNavigationframe. - Tracing-related dereferences after callbacks. The introducing commit added
condition->TraceEventName()after the call. Look for other trace calls that read object state after a callback that may have destroyed the object. A positive result is a read in a trace helper on freed memory.
Credit
The report asks that [redacted] be used as the credit for this vulnerability.
What happened, in plain words
Google Chrome is a web browser. Inside it, one part (the browser process) is in charge of the window, the tabs, the address bar and the network, and another part (the renderer process) turns a web page's HTML, CSS and JavaScript into what you see. The two parts talk to each other through a messaging system called Mojo.
When you click a link or press the back button, Chrome has to decide whether to show the new page. That decision is called a navigation. Just before the new page is shown ("committed"), Chrome runs a short checklist of conditions that are allowed to say "wait a moment". This report is about a bug in the code that runs that checklist, called CommitDeferringConditionRunner.
The bug is a use-after-free. In plain words: a program asks the computer for a piece of memory, uses it, gives it back, and then later uses it again as if it still belonged to it. The memory may already have been handed to something else, so the second use reads or writes the wrong data. In C and C++ this is a serious mistake, and it can crash the program or, in the worst case, let an attacker influence what the program does.
The specific trigger involves the back-forward cache (often shortened to BFCache). This is a Chrome feature that keeps a page alive in memory when you navigate away from it, so that pressing Back shows it again instantly instead of reloading it. When Chrome restores a page from that cache, it has to tell the page's renderer that it is leaving the cache. It sends a message called SetPageLifecycleState over a Mojo channel called PageBroadcast.
The report says that if that channel is already broken (in an error state), the send fails immediately, and the failure runs a chain of cleanup callbacks inside the same function call that was still using the condition object. One of those callbacks removes and destroys the condition. When the original function resumes, it reads a field of the object that no longer exists. That is the use-after-free.
The report frames the trigger as something a compromised renderer can do: a renderer that an attacker already controls can close its end of the PageBroadcast channel before the page goes into the cache, and then a simple history.back() restores the page and hits the bug. The report does not describe a way for an ordinary web page to do this without a compromised renderer.
The report is filed through the Chrome VRP (Vulnerability Reward Program), the scheme Google uses to pay people who report security bugs. The researcher is credited as [redacted], the severity is high, and the bounty was 36,000 USD. The report does not give a CVSS score.
Context
This section explains the pieces of Chrome that the bug touches, so the rest of the report makes sense.
Navigation and commit
A navigation is any action that takes the browser from one page to another: typing a URL, clicking a link, submitting a form, or pressing Back. Chrome does not switch pages instantly. It first creates a navigation request, fetches the response, runs a series of checks, and only then commits the new page, meaning it becomes the page shown in the tab.
Commit deferring conditions
A commit deferring condition is a small object that gets a chance to pause a navigation just before commit. The runner, CommitDeferringConditionRunner, keeps a list (a vector, which is a growable array) of these conditions and calls each one in turn.
Each condition has a method called WillCommitNavigation. It can answer in two ways:
- "Go ahead" (the code calls this result
kProceed). - "Wait" (the code calls this result
kDefer).
When a condition says "wait", the runner stores a resume closure and returns. A closure (also called a callback) is a small bundle of code plus the data it needs, which can be called later. When the condition is finished with its work, it calls the resume closure, and the runner's ResumeProcessing method removes that condition from the list and moves on to the next one.
The back-forward cache
When you navigate away from a page, Chrome can keep it in memory instead of throwing it away. This is the back-forward cache. It makes Back and Forward feel instant. When the page is restored, Chrome must tell the renderer that the page is leaving the cache, so the renderer can resume normal behaviour.
The condition that handles this is BackForwardCacheCommitDeferringCondition. It defers the commit while the browser notifies each RenderViewHost. A RenderViewHost is the browser-side object that represents one rendered view of a page.
The notification is sent as SetPageLifecycleState over a Mojo associated remote called PageBroadcast. "Associated" means the channel is tied to a specific renderer and its lifetime; "remote" means it is the browser's handle to the other side.
Platforms and metadata
The report states the bug affects all desktop platforms: Linux, Windows, macOS and ChromeOS.
Setup
The researcher tested the bug at a specific version of the Chrome source code, identified by a commit hash:
A commit hash is a long fingerprint that uniquely identifies one saved state of the source code in a version-control system (Chrome uses Git). Saying "tested at commit X" is like saying "tested on this exact snapshot of the code".
The test machine was Linux on the x86_64 architecture (ordinary 64-bit Intel/AMD style hardware). The build was an ASAN build. ASAN stands for AddressSanitizer, a tool built into the compiler that watches memory use and prints a detailed report when a program reads or writes memory it should not. The build settings were is_asan = true and is_debug = false: ASAN on, and an optimised (release-style) build rather than a debug build.
A renderer-side patch is required. A patch is a small change to source code. The report says the patch is called patch.diff and must be applied before building. It changes only renderer-process code, specifically WebViewImpl::SetPageLifecycleState, and adds a receiver_.reset() call after the BFCache lifecycle acknowledgment has been sent. In plain words: the patch makes the renderer deliberately close its end of the PageBroadcast channel right after it has confirmed the cache transition. That is how the researcher simulates a compromised renderer without actually having one.
The report also includes an HTTP server and a page, page1.html, served on port 8765. An HTTP server is a program that hands files to a browser when the browser asks for them; here it serves the two test pages locally. No accounts or roles are involved. The precondition is a renderer that can reset its PageBroadcast associated receiver after the BFCache lifecycle acknowledgment has been sent, which the report frames as something a compromised renderer can do.
Finding it
The researcher found a reentrancy hazard in CommitDeferringConditionRunner::ProcessConditions. Reentrancy means a function is entered again before its previous run has finished, like a shop assistant who starts serving a second customer while still halfway through the first. The method takes a raw pointer to the current condition before calling WillCommitNavigation. A raw pointer is just a memory address with no safety net: nothing checks whether the object at that address still exists.
The code assumes that when WillCommitNavigation returns kDefer, the resume closure will only run asynchronously, meaning later, after the current function has returned. If instead the closure runs synchronously, meaning immediately, inside the call, then ResumeProcessing erases and destroys the condition while the outer function still holds the pointer. The outer function then reads through a pointer to freed memory.
The BFCache restore path makes that synchronous execution possible. The resume closure is wrapped in a BarrierClosure and distributed to each RenderViewHost. A barrier closure is a helper that waits until a set number of partial callbacks have all run, then runs one final callback. Each partial closure is wrapped with mojo::WrapCallbackWithDefaultInvokeIfNotRun, so it is guaranteed to run even if the Mojo send fails. When the PageBroadcast endpoint is already in an error state, the send fails synchronously, the responder is destroyed, and the default callback fires the barrier, which fires the resume closure, which reenters ResumeProcessing.
A bisect is a technique for finding which code change introduced a bug: you test the middle of a range of commits, see whether the bug is present, and keep halving the range. The bisect attributes the dereference site to commit [redacted], dated 2024-10-03, authored by Lingqi Chi, reviewed at https://chromium-review.googlesource.com/c/chromium/src/+/5884681. That commit added the condition->TraceEventName() usage in the kDefer case of ProcessConditions, which is the dangling-pointer dereference site. A dangling pointer is a pointer whose object has already been freed.
The report notes that the underlying reentrant-resume hazard has existed since CommitDeferringConditionRunner was introduced in 1bdb3701f9ae1 on 2021-04-30 (https://chromium-review.googlesource.com/c/chromium/src/+/2716161), but the dereference after the WillCommitNavigation call was not present until the tracing commit. In other words: the dangerous pattern was old, but the line that actually reads the freed memory was added later, when tracing support was added.
Exploitation
This section walks through the reproduction step by step. "Exploitation" here means demonstrating the crash, not taking over a machine.
Step 1: Build with the renderer patch
Apply patch.diff and build an ASAN release configuration. The patch adds receiver_.reset() in WebViewImpl::SetPageLifecycleState after the BFCache lifecycle acknowledgment is sent, simulating a compromised renderer that closes its PageBroadcast receiver on entering the cache.
Why this step: without a way to make the renderer close the channel at the right moment, the bug cannot be reached. The patch is the stand-in for an attacker who already controls the renderer.
Step 2: Start the server and launch Chrome
python3 issue_bfcache_commit_defer_uaf/server.py &
ASAN_OPTIONS=detect_odr_violation=0 xvfb-run -a out/asan-release/chrome \
--user-data-dir=/tmp/poc-bfcache-uaf \
http://localhost:8765/page1.html
Line by line:
python3 issue_bfcache_commit_defer_uaf/server.py &runs the included HTTP server with Python 3. The&at the end puts it in the background so the terminal is free for the next command. The server serves the test page on port 8765.ASAN_OPTIONS=detect_odr_violation=0sets an environment variable for the next program.xvfb-run -astarts the program inside a virtual display. Xvfb is a fake graphical screen that lets a browser run on a machine with no monitor, such as a test server.-atells it to pick a free display number automatically.out/asan-release/chromeis the path to the built Chrome binary, in the ASAN release output directory.--user-data-dir=/tmp/poc-bfcache-uafgives Chrome a fresh, separate profile directory. This avoids mixing with your normal browsing data and makes the test repeatable.http://localhost:8765/page1.htmlis the first page Chrome opens.localhostmeans this same machine, and8765is the port the Python server is listening on.
Why this step: the server provides the two pages, and the launch command runs the instrumented browser in a controlled, headless environment so the crash can be observed and recorded.
Step 3: Let the pages drive the navigation
Page 1 automatically navigates to page 2 after one second, which puts page 1 into the back-forward cache. Page 2 calls history.back() after two seconds, restoring page 1. No user interaction is required. The browser process crashes with a heap-use-after-free within approximately four seconds.
Why this step: the timing is the whole trick. Page 1 must go into the cache first, so that the restore path runs. Page 2 then triggers the restore with history.back(), which is the same as pressing the Back button in JavaScript. Because the renderer patch has already closed the PageBroadcast channel, the restore hits the broken endpoint and the synchronous failure chain runs.
Step 4: Read the ASAN report
==13056==ERROR: AddressSanitizer: heap-use-after-free on address 0x7b7d595cc658 at pc 0x7f3dbf9b442f bp 0x7ffc1605b590 sp 0x7ffc1605b588
READ of size 8 at 0x7b7d595cc658 thread T0 (chrome)
#0 0x7f3dbf9b442e in content::BackForwardCacheImpl::WillCommitNavigationToCachedEntry(content::BackForwardCacheImpl::Entry&, base::OnceCallback<void ()>) gen/third_party/libc++/src/include/__tree:208:12
#1 0x7f3dbf9a2a0d in content::BackForwardCacheCommitDeferringCondition::WillCommitNavigation(base::OnceCallback<void ()>) content/browser/renderer_host/back_forward_cache_commit_deferring_condition.cc:65:11
#2 0x7f3dbfa14e8a in content::CommitDeferringConditionRunner::ProcessConditions() content/browser/renderer_host/commit_deferring_condition_runner.cc:219:24
#3 0x7f3dbfcae89e in content::NavigationRequest::RunCommitDeferringConditions(base::OnceCallback<void ()>) content/browser/renderer_host/navigation_request.cc:6507:21
#4 0x7f3dbfce327c in content::NavigationRequest::OnWillProcessResponseChecksComplete(content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:6422:3
#5 0x7f3dbfcfa969 in content::NavigationRequest::OnWillProcessResponseProcessed(content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:8351:3
#6 0x7f3dbfcf9001 in content::NavigationRequest::OnNavigationEventProcessed(content::NavigationThrottleEvent, content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_request.cc:8246:7
#7 0x7f3dbfd5f468 in content::NavigationThrottleRegistryImpl::OnEventProcessed(content::NavigationThrottleEvent, content::NavigationThrottle::ThrottleCheckResult) content/browser/renderer_host/navigation_throttle_registry_impl.cc:321:24
#8 0x7f3dbfd64b1d in content::NavigationThrottleRunner::InformRegistry(content::NavigationThrottle::ThrottleCheckResult const&) content/browser/renderer_host/navigation_throttle_runner.cc:249:14
#9 0x7f3dbfd637b0 in content::NavigationThrottleRunner::ProcessInternal() content/browser/renderer_host/navigation_throttle_runner.cc:238:3
#10 0x7f3dbfd61afa in content::NavigationThrottleRunner::ProcessNavigationEvent(content::NavigationThrottleEvent) content/browser/renderer_host/navigation_throttle_runner.cc:131:3
#11 0x7f3dbfd5cfdf in content::NavigationThrottleRegistryImpl::ProcessNavigationEvent(content::NavigationThrottleEvent) content/browser/renderer_host/navigation_throttle_registry_impl.cc:219:32
#12 0x7f3dbfcd21bd in content::NavigationRequest::WillProcessResponse() content/browser/renderer_host/navigation_request.cc:8617:23
#13 0x7f3dbfccf8c0 in content::NavigationRequest::SelectFrameHostForOnResponseStarted(...) content/browser/renderer_host/navigation_request.cc:5271:3
0x7b7d595cc658 is located 8 bytes inside of 48-byte region [0x7b7d595cc650,0x7b7d595cc680)
freed by thread T0 (chrome) here:
#0 0x55cf8d2b1842 in operator delete(void*, unsigned long)
#1 0x7f3dbff5047f in std::__Cr::__tree<...RenderViewHostImpl...>::__tree_deleter::operator()(...) gen/third_party/libc++/src/include/__new/allocate.h:63:10
#2 0x7f3dbff14316 in content::RenderFrameHostManager::CommitPending(...) gen/third_party/libc++/src/include/__tree:1361:64
...
#11 0x7f3dbfcead80 in content::NavigationRequest::OnCommitDeferringConditionChecksComplete(...) base/functional/callback.h:155:12
#12 0x7f3dbfa15237 in content::CommitDeferringConditionRunner::ProcessConditions() content/browser/renderer_host/commit_deferring_condition_runner.cc:246:14
#13 0x7f3dbfa15dfa in content::CommitDeferringConditionRunner::ResumeProcessing() content/browser/renderer_host/commit_deferring_condition_runner.cc:104:3
...
#16 0x7f3ddcf744c0 in base::(anonymous namespace)::BarrierInfo::Run() base/functional/callback.h:155:12
...
#20 0x7f3dbe8f6ecd in mojo::internal::CallbackWithDeleteHelper<void ()>::~CallbackWithDeleteHelper() base/functional/callback.h:155:12
...
#24 0x7f3ddddfe03a in mojo::InterfaceEndpointClient::SendMessageWithResponder(...) gen/third_party/libc++/src/include/__memory/unique_ptr.h:74:5
#26 0x7f3dd15f2c64 in blink::mojom::PageBroadcastProxy::SetPageLifecycleState(...) gen/third_party/blink/public/mojom/page/page.mojom.cc:668:3
#27 0x7f3dbfd92dc9 in content::PageLifecycleStateManager::SendUpdatesToRendererIfNeeded(...) content/browser/renderer_host/page_lifecycle_state_manager.cc:238:57
#28 0x7f3dbfd95a80 in content::PageLifecycleStateManager::SetIsLeavingBackForwardCache(...) content/browser/renderer_host/page_lifecycle_state_manager.cc:200:3
#29 0x7f3dc00121cc in content::RenderViewHostImpl::PrepareToLeaveBackForwardCache(...) content/browser/renderer_host/render_view_host_impl.cc:677:34
SUMMARY: AddressSanitizer: heap-use-after-free gen/third_party/libc++/src/include/__tree:208:12 in content::BackForwardCacheImpl::WillCommitNavigationToCachedEntry(content::BackForwardCacheImpl::Entry&, base::OnceCallback<void ()>)
This is an ASAN report. It is long, but it is structured. Here is how to read it:
- The first line says what kind of error it is:
heap-use-after-free. The heap is the area of memory where programs allocate objects at runtime. The address0x7b7d595cc658is the memory location involved.pc,bpandspare processor registers: the program counter (where the code was), the base pointer and the stack pointer. You do not need them to understand the bug. READ of size 8means the program read 8 bytes, the size of a pointer on 64-bit systems.thread T0 (chrome)says it happened on thread T0, the browser's main UI thread.- The numbered lines starting with
#0,#1and so on are the call stack at the moment of the bad read.#0is the innermost function, and the numbers go outward. Reading from the top: the read happens inBackForwardCacheImpl::WillCommitNavigationToCachedEntry, which was called byBackForwardCacheCommitDeferringCondition::WillCommitNavigation, which was called byCommitDeferringConditionRunner::ProcessConditions, and so on up through the navigation machinery. The file and line after each function name (for examplecommit_deferring_condition_runner.cc:219:24) tell you exactly where in the source code that frame was. - The line
0x7b7d595cc658 is located 8 bytes inside of 48-byte regiontells you the object was 48 bytes long and the read was 8 bytes into it. That matches reading a pointer-sized field inside a small object. - The second stack, under
freed by thread T0 (chrome) here:, is the call stack at the moment the memory was freed, that is, given back.operator deleteis the C++ function that releases memory. The frames below it show the chain:InterfaceEndpointClient::SendMessageWithResponderdestroys the responder,CallbackWithDeleteHelperruns the default callback,BarrierInfo::Runfires the barrier,ResumeProcessingerases the condition, andProcessConditionscontinues intoOnCommitDeferringConditionChecksComplete. - The
SUMMARYline repeats the key finding: a heap-use-after-free, with the innermost read frame named.
Putting the two stacks together tells the whole story: the memory was freed during the synchronous callback chain (second stack), and then read shortly afterwards by the outer navigation code (first stack). The report notes that the read is 8 bytes wide, the freed region is 48 bytes, and the read is 8 bytes inside it.
Root cause
This section shows the actual code. You do not need to be a C++ programmer to follow the shape of it; focus on the order of events.
CommitDeferringConditionRunner::ProcessConditions iterates a vector of conditions and extracts a raw pointer before invoking WillCommitNavigation:
// content/browser/renderer_host/commit_deferring_condition_runner.cc
CommitDeferringCondition* condition = (*conditions_.begin()).get();
is_deferred_ = false;
switch (condition->WillCommitNavigation(std::move(resume_closure))) {
case CommitDeferringCondition::Result::kDefer:
is_deferred_ = true;
TRACE_EVENT_BEGIN("navigation",
perfetto::DynamicString(condition->TraceEventName()),
perfetto::Track::FromPointer(this));
return;
Line by line:
CommitDeferringCondition* condition = (*conditions_.begin()).get();takes the first condition in the list and stores its address in a raw pointer calledcondition. From this moment,conditionis just a number pointing at memory; it does not keep the object alive.is_deferred_ = false;resets a flag that records whether the runner is currently waiting.switch (condition->WillCommitNavigation(std::move(resume_closure)))calls the condition's method, handing it the resume closure.std::moveis a C++ hint that the closure is being given away, not copied.case CommitDeferringCondition::Result::kDefer:handles the "wait" answer.is_deferred_ = true;records that the runner is now waiting.TRACE_EVENT_BEGIN(...)starts a tracing event, a marker used by performance tools. Crucially, it callscondition->TraceEventName(), which reads a field from the object through the raw pointer. This is the line added by the later commit, and it is the line that reads freed memory if the object was destroyed during step 3.return;leaves the function.
The code assumes that when WillCommitNavigation returns kDefer, the resume_closure will only be called asynchronously. ResumeProcessing erases the front condition and recurses into ProcessConditions:
// content/browser/renderer_host/commit_deferring_condition_runner.cc
void CommitDeferringConditionRunner::ResumeProcessing() {
DCHECK(is_deferred_);
is_deferred_ = false;
DCHECK(!conditions_.empty());
conditions_.erase(conditions_.begin());
ProcessConditions();
}
Line by line:
DCHECK(is_deferred_);is a debug assertion: a check that only runs in debug builds. It confirms the runner was in the waiting state. In a release build it does nothing.is_deferred_ = false;clears the waiting flag.DCHECK(!conditions_.empty());is another debug-only check that the list is not empty.conditions_.erase(conditions_.begin());removes the first condition from the list. Removing it destroys the object, because the list owns it. This is the free.ProcessConditions();calls the runner again to handle the next condition. This is the recursion, and it is what makes the whole thing reentrant.
For BFCache restores, BackForwardCacheCommitDeferringCondition::WillCommitNavigation passes the resume closure into BackForwardCacheImpl::WillCommitNavigationToCachedEntry, which wraps it in a BarrierClosure and distributes partial closures to each RenderViewHost via PrepareToLeaveBackForwardCache:
// content/browser/renderer_host/back_forward_cache_impl.cc
auto cb = base::BarrierClosure(
bfcache_entry.render_view_hosts().size(),
base::BindOnce([](base::OnceClosure cb) { std::move(cb).Run(); },
std::move(done_callback)));
for (const auto& rvh : bfcache_entry.render_view_hosts()) {
rvh->PrepareToLeaveBackForwardCache(cb);
}
Line by line:
auto cb = base::BarrierClosure(creates the barrier. The first argument is how many partial callbacks must run before the final one fires.bfcache_entry.render_view_hosts().size(),is that count: the number of render view hosts in the cached entry.base::BindOnce([](base::OnceClosure cb) { std::move(cb).Run(); },builds the final callback. When the barrier is satisfied, it runs the original resume closure (done_callback).std::move(done_callback)));hands the original resume closure into the barrier.for (const auto& rvh : bfcache_entry.render_view_hosts()) {loops over each render view host.rvh->PrepareToLeaveBackForwardCache(cb);gives each one a partial callback. When all of them have run, the barrier fires the final callback.}closes the loop.
Each RenderViewHostImpl::PrepareToLeaveBackForwardCache wraps its closure in mojo::WrapCallbackWithDefaultInvokeIfNotRun to guarantee execution even on failure, then passes it through PageLifecycleStateManager::SendUpdatesToRendererIfNeeded, which sends SetPageLifecycleState on the PageBroadcast associated remote:
// content/browser/renderer_host/render_view_host_impl.cc
page_lifecycle_state_manager_->SetIsLeavingBackForwardCache(
mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(done_cb)));
// content/browser/renderer_host/page_lifecycle_state_manager.cc
render_view_host_impl_->GetAssociatedPageBroadcast()->SetPageLifecycleState(
std::move(state), std::move(page_restore_params),
base::BindOnce(&PageLifecycleStateManager::OnSetPageLifecycleStateResponse,
weak_ptr_factory_.GetWeakPtr(), std::move(new_state),
std::move(done_cb)));
Line by line:
page_lifecycle_state_manager_->SetIsLeavingBackForwardCache(calls the lifecycle manager to record that the page is leaving the cache.mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(done_cb)));wraps the partial callback so that, if the Mojo send never completes, a default version is invoked anyway. The name says exactly what it does: wrap the callback, and invoke a default if it has not run. This is a safety feature, but it is also what makes the failure synchronous.render_view_host_impl_->GetAssociatedPageBroadcast()->SetPageLifecycleState(gets thePageBroadcastremote and callsSetPageLifecycleStateon it, sending the lifecycle update to the renderer.std::move(state), std::move(page_restore_params),pass the new lifecycle state and the restore parameters.base::BindOnce(&PageLifecycleStateManager::OnSetPageLifecycleStateResponse,builds the response callback, which runs when the renderer replies.weak_ptr_factory_.GetWeakPtr(), std::move(new_state),passes a weak pointer (a pointer that does not keep the object alive, so the callback can safely detect that the manager is gone) and the new state.std::move(done_cb)));passes the wrapped partial callback along, so it runs when the response arrives or when the default fires.
When the PageBroadcast endpoint is in an error state, InterfaceEndpointClient::SendMessageWithResponder returns false without storing the responder. The responder, a unique_ptr<MessageReceiver> local to the function, is destroyed at function exit. Its destructor chain reaches the CallbackWithDeleteHelper installed by WrapCallbackWithDefaultInvokeIfNotRun, which synchronously invokes the default callback. That fires the barrier closure, which calls the resume closure, which reenters ResumeProcessing and erases the condition from the vector, all within the original WillCommitNavigation call stack:
// mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
if (encountered_error_) {
message->NotifyPeerClosureForSerializedHandles(handle_.group_controller());
return false;
// responder (unique_ptr) destroyed here -> ~CallbackWithDeleteHelper
// -> barrier closure -> resume -> conditions_.erase(begin())
}
Line by line:
if (encountered_error_) {checks whether the channel is already broken. This is the error state mentioned earlier.message->NotifyPeerClosureForSerializedHandles(handle_.group_controller());tells the other side about any handles attached to the message, so they are not leaked.return false;reports that the send did not happen. The responder was never stored.- The comments spell out the consequence: the responder, a
unique_ptr(a smart pointer that frees its object automatically when it goes out of scope), is destroyed as the function exits. That destruction runs~CallbackWithDeleteHelper, which runs the barrier closure, which runs the resume closure, which callsconditions_.erase(begin())and frees the condition.
After WillCommitNavigation returns kDefer, the outer ProcessConditions dereferences the cached condition pointer, which now points to freed memory. The dereference in the report is the condition->TraceEventName() call added by the tracing commit.
A compromised renderer triggers this by resetting its PageBroadcast associated receiver after the BFCache lifecycle acknowledgment has been sent. RenderViewHostImpl::BindPageBroadcast installs no disconnect handler on the browser-side remote, so the page remains in the cache with a silently broken endpoint. A disconnect handler is code that runs when the other end of a channel goes away; without one, the browser does not notice that the channel is dead. A subsequent history.back() from any page restores the cached entry and hits the vulnerable path.
The DCHECK(is_deferred_) and DCHECK(!conditions_.empty()) in ResumeProcessing are debug assertions; the report does not discuss them as defences. The WrapCallbackWithDefaultInvokeIfNotRun wrapper, which exists to guarantee the callback runs on failure, is precisely what makes the failure synchronous.
Impact
The crash is a heap-use-after-free on the browser UI thread, which is the browser process. The report describes the trigger as available to a compromised renderer, and the reproduction requires a renderer-side patch to simulate that condition. It states that no user interaction is required once the renderer behaves as described, and that the crash occurs within approximately four seconds.
A sandbox is the isolation layer that stops a compromised renderer from directly touching the rest of the system; an escape from it would be a much bigger problem. The report does not claim one. The severity is high and the bounty was 36,000 USD.
Fix
A fix would need to ensure that the condition pointer is not used after WillCommitNavigation returns if the resume closure may have run synchronously, for example by re-checking the condition's presence in the vector or by not caching a raw pointer across the call.
Variants to test
The following are concrete things to try on other targets, based on the mechanisms in the report. Each is a hypothesis, not a claim from the original.
- Other commit deferring conditions that can complete synchronously. Look for conditions whose
WillCommitNavigationcan invoke the resume closure before returning, for example through a Mojo send that fails on an errored endpoint. A positive result is an ASAN heap-use-after-free inProcessConditionsafter theWillCommitNavigationcall. - Other uses of
mojo::WrapCallbackWithDefaultInvokeIfNotRunin navigation paths. If the default callback can run synchronously and reenter a caller that holds a raw pointer, the same pattern applies. A positive result is a crash whose free stack passes throughCallbackWithDeleteHelperand whose read stack is in the outer caller. - Other associated remotes without disconnect handlers.
RenderViewHostImpl::BindPageBroadcastinstalls none according to the report, so the page stays in the cache with a broken endpoint. Check other browser-side remotes bound to renderer-controlled receivers for the same gap. A positive result is a cached or live object whose endpoint is in an error state while the browser still treats it as usable. - Other reentrant resume paths in
CommitDeferringConditionRunner. Any condition that can call its resume closure synchronously, not only the BFCache condition, would hit the same erase-during-iteration problem. A positive result is aconditions_.erase(conditions_.begin())in the free stack beneath theWillCommitNavigationframe. - Tracing-related dereferences after callbacks. The introducing commit added
condition->TraceEventName()after the call. Look for other trace calls that read object state after a callback that may have destroyed the object. A positive result is a read in a trace helper on freed memory.
Credit
The report asks that [redacted] be used as the credit for this vulnerability.
Glossary
- AddressSanitizer (ASAN): a compiler tool that detects memory errors such as use-after-free and prints a detailed report when one occurs.
- Associated remote: a Mojo channel handle tied to a specific renderer and its lifetime, used by the browser to send messages to that renderer.
- Asynchronous: happening later, after the current function has returned, rather than immediately.
- Back-forward cache (BFCache): a Chrome feature that keeps a page in memory when you navigate away, so Back and Forward are instant.
- Barrier closure: a helper that waits for a set number of partial callbacks to run, then runs one final callback.
- Bisect: a technique for finding the commit that introduced a bug by repeatedly halving a range of commits.
- Bounty: money paid by a company to a researcher who reports a security bug.
- Browser process: the part of Chrome that manages windows, tabs, the address bar and network access.
- Callback (closure): a bundle of code plus its data that can be called later.
- Chrome VRP: Google's Vulnerability Reward Program for Chrome security reports.
- Commit (in navigation): the moment a new page becomes the page shown in the tab.
- Commit deferring condition: a small object that can pause a navigation just before commit.
- Commit hash: a long fingerprint that uniquely identifies one saved state of source code.
- Compromised renderer: a renderer process that an attacker already controls.
- CVSS: a standard scoring system for the severity of security vulnerabilities.
- Dangling pointer: a pointer whose object has already been freed.
- Debug assertion (DCHECK): a check that only runs in debug builds and does nothing in release builds.
- Disconnect handler: code that runs when the other end of a channel goes away.
- Error state (of a Mojo endpoint): the condition where a channel is already broken and sends fail immediately.
- Heap: the area of memory where programs allocate objects at runtime.
- HTTP server: a program that hands files to a browser when the browser asks for them.
- Mojo: Chrome's internal messaging system between processes.
- Navigation: any action that takes the browser from one page to another.
- ODR violation: a C++ rule violation about symbols being defined more than once; ASAN can report these as noise.
- Patch: a small change to source code.
- Raw pointer: a memory address with no safety net; nothing checks whether the object still exists.
- Reentrancy: entering a function again before its previous run has finished.
- Renderer process: the part of Chrome that turns HTML, CSS and JavaScript into what you see.
- RenderViewHost: the browser-side object that represents one rendered view of a page.
- Resume closure: the callback a deferred condition calls when it is finished, so the runner can continue.
- Sandbox: the isolation layer that stops a compromised renderer from directly touching the rest of the system.
- Synchronous: happening immediately, inside the current function call, before it returns.
- Thread: a sequence of instructions running inside a program; Chrome's browser UI work runs on its main thread.
- Use-after-free: using memory after it has been given back, which can crash the program or corrupt data.
- Vector: a growable array, a list that can add and remove items.
- Weak pointer: a pointer that does not keep its object alive, so code can safely detect that the object is gone.
- Xvfb: a virtual display that lets graphical programs run on a machine with no monitor.