Use after free in Chrome for iOS (CVE-2026-10896)
A use-after-free vulnerability exists in Chrome for iOS where a NavigationContextImpl object can be destroyed during observer notifications, leaving callers with dangling pointers. An attacker could potentially exploit this to achieve arbitrary code execution in the unsandboxed browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 19 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential Use-After-Free (UAF) vulnerability exists in iOS Chrome when a NavigationContextImpl is synchronously destroyed during observer notifications. While internal loops are protected, the calling functions continue to use dangling raw pointers to the deallocated context. This issue impacts the unsandboxed browser process and is not mitigated by MiraclePtr on the iOS platform.
Affected files:
ios/web/web_state/ui/crw_web_controller.mmios/web/web_state/web_state_impl_realized_web_state.mmios/web/navigation/crw_web_view_navigation_observer.mmios/web/navigation/crw_wk_navigation_handler.mmios/web/web_state/ui/crw_web_request_controller.mm
Estimated timestamp from git blame: 2019-03-02
Description
A potential Use-After-Free (UAF) vulnerability has been identified in the iOS implementation of Chromium. The issue arises from the synchronous destruction of web::NavigationContextImpl objects during WebState observer notifications (e.g., DidStartNavigation, DidFinishNavigation).
Chromium previously introduced a mitigation feature, kDetectDestroyedNavigationContexts, which uses a base::WeakPtr to guard the internal observer fan-out loops in WebStateImpl::RealizedWebState. However, this mitigation only protects the loop itself. When control returns to the calling function (typically in CRWWebViewNavigationObserver or CRWWebController), the caller proceeds to dereference its own raw pointer to the NavigationContextImpl, which may have been freed during the observer notification.
Root Cause Analysis
In ios/web/web_state/web_state_impl_realized_web_state.mm, methods like OnNavigationStarted check the context's validity within the loop:
base::WeakPtr<NavigationContextImpl> weak_context = context->GetWeakPtr();
for (auto& observer : observers()) {
if (!weak_context && base::FeatureList::IsEnabled(
features::kDetectDestroyedNavigationContexts)) {
break;
}
observer.DidStartNavigation(owner_, context);
}
If an observer synchronously destroys the WebState or cancels the navigation, the NavigationContextImpl (often owned by CRWWKNavigationStates) is deleted. The loop breaks correctly, but the caller in CRWWebViewNavigationObserver.mm or CRWWebController.mm continues execution using the dangling context pointer.
Impact and Exploitability
This is a high-impact vulnerability because it occurs in the unsandboxed browser process on iOS. Furthermore, MiraclePtr (BackupRefPtr) is not enabled on iOS due to platform-specific address space limitations, meaning these stack-based bare pointers are unprotected.
A particularly dangerous primitive exists in CRWWebViewNavigationObserver::webViewLoadingStateDidChange and CRWWebController::URLDidChangeWithoutDocumentChange::
// CRWWebViewNavigationObserver.mm
self.navigationManagerImpl->CommitPendingItem(
existingContext->ReleaseItem());
If existingContext is freed and its memory reclaimed by an attacker, the ReleaseItem() call (which moves a std::unique_ptr<NavigationItemImpl>) can be manipulated to return a pointer to an attacker-controlled memory region. Subsequent operations on this NavigationItemImpl by the NavigationManager can lead to arbitrary code execution (RCE).
Suggested Potential Steps to Reproduce
- Host a malicious page that performs history manipulation (e.g.,
history.go(-1)) or fragment changes (location.hash = '#...') to triggerWKWebViewKVO notifications. - Implement a
WebStateObserverthat, upon receivingDidStartNavigation, synchronously destroys theWebState(e.g., by closing the tab or removing it from theWebStateList). - The browser process will reach the KVO handler in
CRWWebViewNavigationObserverorCRWWebController, callOnNavigationStarted, and then attempt to dereference the deallocated context pointer (e.g., callingReleaseItem()orSetHasCommitted()). - Reclaim the freed memory during the observer callback to control the values read during the UAF.
Proposed Fix
Callers that trigger observer notifications for a NavigationContextImpl must use base::WeakPtr<NavigationContextImpl> to track its lifetime and check for its existence before any subsequent dereference.
For example, in CRWWebViewNavigationObserver.mm:
base::WeakPtr<web::NavigationContextImpl> weakContext = existingContext->GetWeakPtr();
self.webStateImpl->OnNavigationStarted(existingContext);
if (!weakContext) {
return;
}
// Safe to use weakContext.get() or existingContext here.
Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the caller functions do not use a weak pointer to track the lifetime of the NavigationContextImpl, so they dereference a dangling raw pointer after observer notifications may have destroyed the object.
Impact
This could lead to arbitrary code execution in the unsandboxed browser process, and the issue is not mitigated by MiraclePtr on iOS.
What the attacker needed
Victim visits a malicious page; attacker can trigger navigation events; memory reclamation during callback
The fix
Callers should use a base::WeakPtr to track the NavigationContextImpl's lifetime and check for its existence before any subsequent dereference.
How it was found
- Host a malicious page that performs history manipulation or fragment changes to trigger WKWebView KVO notifications.
- Implement a WebStateObserver that synchronously destroys the WebState upon receiving DidStartNavigation.
- The browser process reaches the KVO handler, calls OnNavigationStarted, and then attempts to dereference the deallocated context pointer.
- Reclaim the freed memory during the observer callback to control the values read during the UAF.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A use-after-free happens when a program frees memory but keeps using it, like deleting a file and then trying to open it. Here, a navigation object is deleted while other code still holds a pointer to it, and an attacker might reclaim that memory to control what happens next. This could let them run their own code on the device.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.