Skip to content
Memory corruption Advisory Advanced CVE-2026-13807

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.mm
  • components/user_data_importer/utility/safari_data_importer.cc
  • ios/chrome/browser/safari_data_import/coordinator/safari_data_import_import_mediator.mm
  • components/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:

  1. Background Execution: During an import, SafariDataImporter wraps IOSBookmarkParser inside a base::SequenceBound<BlockingWorker> assigned to a base::ThreadPool sequence (safari_data_importer.cc:274-276).
  2. WeakPtr Binding: When IOSBookmarkParser::Parse runs on this background thread, it creates a WeakPtr and binds it to TriggerParseInJS. This callback is passed to a LocalNavigationForwarder acting as a WKNavigationDelegate for a WKWebView (ios_bookmark_parser.mm:221-224).
  3. Cross-Sequence Callback: WebKit always dispatches WKNavigationDelegate callbacks, such as webView:didFinishNavigation:, on the Main Thread. Consequently, the WeakPtr-bound closure executes on the Main Thread.
  4. 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).
  5. The Race Window: If the user cancels the import while the web view is navigating, the UI triggers a SafariDataImporter teardown on the Main Thread. This posts a task to the ThreadPool to destroy the BlockingWorker and its IOSBookmarkParser.
  6. 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 TriggerParseInJS and blocks on synchronous file I/O ([NSString stringWithContentsOfFile:...] at ios_bookmark_parser.mm:237).
    • While the Main Thread is blocked, the ThreadPool executes the destruction task, freeing the IOSBookmarkParser memory.
    • The Main Thread resumes and accesses this->web_view_ on the freed object (ios_bookmark_parser.mm:247), resulting in a UAF.

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.

  1. Craft a Safari export ZIP archive containing a Bookmarks.html file designed to delay local web view rendering.
  2. On an iOS device, navigate to Chrome Settings -> 'Import from Safari' and select the malicious ZIP.
  3. While the import is processing (and WebKit is parsing), tap the 'Back' or 'Cancel' button to abort the flow.
  4. The race condition will trigger when the Main Thread resumes from the synchronous JS resource loading and accesses the freed IOSBookmarkParser instance.

Suggested Fix

  1. Architectural Fix: WKWebView and its delegates should only be created and accessed on the Main Thread (UI thread). IOSBookmarkParser should not be executed on a base::ThreadPool sequence if it relies on UIKit/WebKit components.
  2. Thread Safety: If background parsing is required, the WKNavigationDelegate callback must explicitly post a task back to the IOSBookmarkParser's bound ThreadPool sequence before evaluating the WeakPtr and accessing this.
  3. Defense in Depth: Convert the raw WKWebView* web_view_ member variable in IOSBookmarkParser to a base::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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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

  1. Craft a Safari export ZIP archive containing a Bookmarks.html file designed to delay local web view rendering.
  2. On an iOS device, navigate to Chrome Settings -> 'Import from Safari' and select the malicious ZIP.
  3. While the import is processing (and WebKit is parsing), tap the 'Back' or 'Cancel' button to abort the flow.
  4. 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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.