Use after free in Import (CVE-2026-13807)
A race condition in the Safari data import feature on iOS allows a WeakPtr-bound callback to run on the main thread while the owning object is destroyed on a background thread, leading to a use-after-free. An attacker who convinces a user to import a malicious ZIP file could potentially achieve remote code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
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 without the Chrome Security team. Please see go/chrome-ai-generated-security-bugs-faq for more information.
Overview: A race condition during Safari data import on iOS allows a WeakPtr-bound task to execute on the main thread while its owning object is destroyed on a background thread. Because WeakPtr sequence affinity checks are disabled in Release builds, this creates a Time-Of-Check-To-Time-Of-Use (TOCTOU) race. If triggered, it leads to a Use-After-Free (UAF) in the browser process.
Affected files:
components/user_data_importer/ios/ios_bookmark_parser.mmcomponents/user_data_importer/utility/safari_data_importer.ccios/chrome/browser/safari_data_import/coordinator/safari_data_import_import_mediator.mmcomponents/user_data_importer/ios/ios_bookmark_parser.h
Estimated timestamp from git blame: 2026-01-31
Vulnerability Description
There is a potential cross-sequence base::WeakPtr race in the Safari data import feature on iOS, leading to a Use-After-Free (UAF) in the browser process.
The issue stems from how IOSBookmarkParser interacts with threading and WKWebView:
- Background Execution: During an import,
SafariDataImporterwrapsIOSBookmarkParserinside abase::SequenceBound<BlockingWorker>assigned to abase::ThreadPoolsequence (safari_data_importer.cc:274-276). - WeakPtr Binding: When
IOSBookmarkParser::Parseruns on this background thread, it creates aWeakPtrand binds it toTriggerParseInJS. This callback is passed to aLocalNavigationForwarderacting as aWKNavigationDelegatefor aWKWebView(ios_bookmark_parser.mm:221-224). - Cross-Sequence Callback: WebKit always dispatches
WKNavigationDelegatecallbacks, such aswebView:didFinishNavigation:, on the Main Thread. Consequently, theWeakPtr-bound closure executes on the Main Thread. - Release Build Behavior: In Chrome Release builds (
DCHECK_IS_ON() == false),base::WeakPtr::IsValid()only checks an atomic flag and does not enforce sequence affinity (base/memory/weak_ptr.cc:36-40). - The Race Window: If the user cancels the import while the web view is navigating, the UI triggers a
SafariDataImporterteardown on the Main Thread. This posts a task to the ThreadPool to destroy theBlockingWorkerand itsIOSBookmarkParser. - UAF Trigger:
- The Main Thread receives the WebKit callback and successfully validates the
WeakPtr(the atomic flag is still valid because the background destruction task hasn't run). - The Main Thread enters
TriggerParseInJSand blocks on synchronous file I/O ([NSString stringWithContentsOfFile:...]atios_bookmark_parser.mm:237). - While the Main Thread is blocked, the ThreadPool executes the destruction task, freeing the
IOSBookmarkParsermemory. - The Main Thread resumes and accesses
this->web_view_on the freed object (ios_bookmark_parser.mm:247), resulting in a UAF.
- The Main Thread receives the WebKit callback and successfully validates the
Potential Impact
An attacker who convinces a user to import a malicious Safari export ZIP file could potentially achieve Remote Code Execution (RCE) in the unsandboxed browser process. By using other files in the ZIP to groom the heap concurrently, the attacker could control the reclaimed memory, hijacking the objc_msgSend dispatch when the stale web_view_ pointer is used.
Suggested Reproduction Steps
Note: These are theoretical steps based on code analysis; a working Proof of Concept has not yet been developed.
- Craft a Safari export ZIP archive containing a
Bookmarks.htmlfile designed to delay local web view rendering. - On an iOS device, navigate to Chrome Settings -> 'Import from Safari' and select the malicious ZIP.
- While the import is processing (and WebKit is parsing), tap the 'Back' or 'Cancel' button to abort the flow.
- The race condition will trigger when the Main Thread resumes from the synchronous JS resource loading and accesses the freed
IOSBookmarkParserinstance.
Suggested Fix
- Architectural Fix:
WKWebViewand its delegates should only be created and accessed on the Main Thread (UI thread).IOSBookmarkParsershould not be executed on abase::ThreadPoolsequence if it relies on UIKit/WebKit components. - Thread Safety: If background parsing is required, the
WKNavigationDelegatecallback must explicitly post a task back to theIOSBookmarkParser's bound ThreadPool sequence before evaluating theWeakPtrand accessingthis. - Defense in Depth: Convert the raw
WKWebView* web_view_member variable inIOSBookmarkParserto abase::raw_ptr<WKWebView>. This would enable MiraclePtr (BackupRefPtr) mitigations on iOS, converting the exploitable UAF into a safer crash.
Evaluated with Chrome root at commit: 7353d249d9cacf9c7218e1d7b8a39cf39c72d646
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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 code creates a WeakPtr on a background thread but the callback runs on the main thread, and in release builds the WeakPtr does not check which thread it belongs to, so it can be used after the object is destroyed.
Impact
An attacker who convinces a user to import a malicious Safari export ZIP file could potentially achieve remote code execution in the unsandboxed browser process.
What the attacker needed
IOS device; user imports a malicious ZIP file; user cancels during import
The fix
The fix should ensure that WKWebView and its delegates are only created and accessed on the main thread, and that the WKNavigationDelegate callback posts a task back to the correct thread before evaluating the WeakPtr.
How it was found
- Craft a Safari export ZIP archive containing a Bookmarks.html file designed to delay local web view rendering.
- On an iOS device, navigate to Chrome Settings -> 'Import from Safari' and select the malicious ZIP.
- While the import is processing (and WebKit is parsing), tap the 'Back' or 'Cancel' button to abort the flow.
- The race condition will trigger when the Main Thread resumes from the synchronous JS resource loading and accesses the freed IOSBookmarkParser instance.
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.
When you import bookmarks from Safari, Chrome reads a file in the background. A timing mistake means Chrome can free the memory holding that file's data while still using it, which is called a use-after-free. An attacker could craft a file that makes this happen and possibly run their own code on your 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.