Inappropriate implementation in iOS (CVE-2026-9971)
A timing flaw in the iOS Chrome bookmarks UI defers running a bookmarklet until the dismissal animation ends, and the target tab is looked up only at that later moment. A malicious site could navigate the tab to a sensitive origin during the delay so the bookmarklet runs there, potentially giving universal cross-site scripting.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 27 days
Flapjack, 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 https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A Time-Of-Check to Time-Of-Use (TOCTOU) vulnerability exists in the iOS Bookmarks UI when executing bookmarklets. The execution is deferred until the UI dismissal animation completes, allowing a malicious site to navigate the active tab in the background to a sensitive origin before the bookmarklet runs.
Affected files:
ios/chrome/browser/bookmarks/ui_bundled/home/bookmarks_coordinator.mm
Estimated timestamp from git blame: 2025-07-02
Summary
A Time-Of-Check to Time-Of-Use (TOCTOU) race condition in the iOS Bookmarks implementation may allow for Universal Cross-Site Scripting (UXSS). When a user selects a bookmarklet (javascript: URL) from the Bookmarks UI, its execution is deferred until after the Bookmarks modal finishes its dismissal animation (which takes approximately 0.3 - 0.5 seconds). Because the target execution context is resolved only after this delay, a malicious site can navigate the tab to a sensitive origin during the animation, causing the bookmarklet to execute on the new origin.
Technical Details
In ios/chrome/browser/bookmarks/ui_bundled/home/bookmarks_coordinator.mm, the method dismissBookmarkBrowserAnimated:urlsToOpen:inIncognito:newTab: handles the dismissal of the bookmarks UI. The URL opening logic is wrapped in a dismissCompletion block that executes after the animation finishes:
ProceduralBlock dismissCompletion = base::CallbackToBlock(base::BindOnce(
[](__weak __typeof(self) weakSelf, std::vector<GURL> urls_to_open,
BOOL in_incognito, BOOL new_tab) {
[weakSelf openUrls:urls_to_open
inIncognito:in_incognito
newTab:new_tab];
},
self, urlsToOpen, inIncognito, newTab));
When the animation completes, dismissCompletion eventually triggers openURLInCurrentTab:, which fetches the currently active WebState to execute the JavaScript:
- (void)openURLInCurrentTab:(const GURL&)url {
Browser* browser = self.browser;
WebStateList* webStateList = browser->GetWebStateList();
if (url.SchemeIs(url::kJavaScriptScheme) && webStateList) {
LoadJavaScriptURL(url, browser, webStateList->GetActiveWebState());
return;
}
// ...
}
The vulnerability stems from the fact that webStateList->GetActiveWebState() and subsequently its last committed URL are evaluated at the time of use (after the animation) rather than at the time the user tapped the bookmarklet.
Potential Exploitation Scenario
Note: These are suggested steps; our tooling agent has not executed a live proof-of-concept.
- An attacker tricks a user into saving a malicious bookmarklet.
- The user visits the attacker's website (e.g.,
https://attacker.com). - The attacker's site includes a script that listens for the
blurevent on the window. - The user opens the Bookmarks UI. This causes the underlying web page to lose focus, triggering the
blurevent. - The attacker's script immediately initiates a navigation to a sensitive origin, such as
https://mail.google.com. - In the Bookmarks UI, the user taps the malicious bookmarklet.
- The UI dismissal animation begins (taking ~0.4 seconds). Bookmarklet execution is deferred.
- During the animation, the background navigation to
https://mail.google.comcommits in theWKWebView. - The animation completes, and
openURLInCurrentTab:fetches the activeWebState, which now points tomail.google.com. - The malicious JavaScript executes within the context of
mail.google.com, potentially allowing the attacker to access sensitive data.
Recommended Mitigation
The execution context should be pinned to the state at the moment the bookmarklet is tapped, not after the animation completes.
Simply capturing the web::WebState* at the time of the click is insufficient, because in iOS Chrome, a WebState object represents a tab and its pointer remains the same across cross-origin navigations.
A robust fix should capture an identifier of the committed document (e.g., the GetLastCommittedURL()) at the time the user taps the bookmarklet, and verify that the WebState's last committed URL still matches this captured URL immediately before executing the JavaScript in LoadJavaScriptURL or openURLInCurrentTab:.
Evaluated with Chrome root at commit: cc901875d53bf4e4fe0e01f02843871da4106e70
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
The active tab and its last committed URL are resolved after the dismissal animation instead of being pinned when the user taps the bookmarklet.
Impact
The bookmarklet could run in the context of a sensitive origin, potentially letting the attacker access sensitive data; the report notes no live proof-of-concept was executed.
What the attacker needed
Victim saves a malicious bookmarklet; victim visits the attacker's site; victim opens bookmarks and taps it
The fix
The fix should record the committed URL when the bookmarklet is tapped and check it still matches just before the JavaScript runs.
How it was found
- The user saves a malicious bookmarklet and later visits the attacker's site.
- The attacker's page listens for the window losing focus.
- The user opens the Bookmarks UI, which blurs the page and triggers the attacker's navigation to a sensitive origin.
- The user taps the malicious bookmarklet and the dismissal animation starts, deferring execution.
- The background navigation commits during the animation.
- When the animation ends, the bookmarklet runs against the newly active page.
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 bookmarklet is a small piece of JavaScript saved as a bookmark. Chrome on iOS waits for the bookmarks menu to finish closing before running it, and only then checks which page is open. If a website changes the open page during that short wait, the script runs on the wrong site, which could let an attacker read data on a site you are logged into.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.