Race condition in Mobile (CVE-2026-87517)
A race condition in Chrome for iOS bookmarks allowed a background page to navigate to another origin after the bookmarks sheet was opened but before a bookmarklet was tapped. The URL check that guards bookmarklet execution then compared against the already-changed URL, so a javascript: bookmarklet could run in the context of the newly navigated origin.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential Time-of-Check to Time-of-Use (TOCTOU) vulnerability exists in the Bookmarks UI of Chrome for iOS, allowing bypass of the Universal Cross-Site Scripting (UXSS) guard. Because the baseline URL snapshot is captured when a user taps a bookmarklet rather than when the Bookmarks modal is originally presented, a webpage can silently navigate in the background. If a user subsequently selects a bookmarklet, the script evaluates in the context of the newly navigated target origin.
Affected files:
ios/chrome/browser/bookmarks/ui_bundled/home/bookmarks_coordinator.mm
Estimated timestamp from git blame: 2026-05-07
Root Cause
In ios/chrome/browser/bookmarks/ui_bundled/home/bookmarks_coordinator.mm, the UXSS guard inside -[BookmarksCoordinator openURLInCurrentTab:urlBeforeDismissal:] checks whether the active WebState's current URL matches urlBeforeDismissal. If they match, a bookmarklet's javascript: payload is executed via LoadJavaScriptURL.
However, the urlBeforeDismissal snapshot is captured too late: inside -[BookmarksCoordinator dismissBookmarkBrowserAnimated:urlsToOpen:inIncognito:newTab:] which executes when the user taps on the bookmark row, rather than when the Bookmarks modal was originally presented to the user.
// ios/chrome/browser/bookmarks/ui_bundled/home/bookmarks_coordinator.mm
- (void)dismissBookmarkBrowserAnimated:(BOOL)animated
urlsToOpen:(const std::vector<GURL>&) urlsToOpen
inIncognito:(BOOL)inIncognito
newTab:(BOOL)newTab {
...
GURL urlBeforeDismissal;
if (self.browser && self.browser->GetWebStateList()) {
web::WebState* activeWebState =
self.browser->GetWebStateList()->GetActiveWebState();
if (activeWebState) {
urlBeforeDismissal = activeWebState->GetLastCommittedURL(); // <-- Captured at TAP time
}
}
...
}
Because Bookmarks is presented with UIModalPresentationFormSheet (line 688), the underlying WKWebView is not suspended or removed from the active window hierarchy. It continues to run JavaScript and execute top-level navigations while obscured by the Bookmarks sheet.
Potential Trigger Path
Note: These are potential steps deduced from static analysis; our tooling does not currently run dynamic proof-of-concept code.
- A user on a malicious page (
http://attacker.example) has previously saved an attacker-controlledjavascript:bookmarklet (e.g.,javascript:alert(document.domain)). - The user opens the Bookmarks menu, which displays the Bookmarks controller as a
UIModalPresentationFormSheetsheet. - While the Bookmarks sheet is open, the background page (
attacker.example) initiates a cross-origin navigation to a target origin (e.g.,https://mail.google.com). - Once the navigation commits, the active
WebState's committed and visible URLs update to the target origin. - The user taps the saved bookmarklet in the modal list.
-[BookmarksCoordinator dismissBookmarkBrowserAnimated:...]runs, capturingurlBeforeDismissalas the post-navigation URL (https://mail.google.com).- During
-[BookmarksCoordinator openURLInCurrentTab:urlBeforeDismissal:], the comparisonsactiveWebState->GetLastCommittedURL() == urlBeforeDismissalandactiveWebState->GetVisibleURL() == urlBeforeDismissalboth evaluate totrue(evaluating"https://mail.google.com" == "https://mail.google.com"). - The security check is bypassed, and
LoadJavaScriptURLexecutes the malicious script inside the context ofhttps://mail.google.com.
Suggested Fix
Capture the active WebState's last committed URL at presentation-time (e.g., inside -[BookmarksCoordinator presentBookmarksAtDisplayedFolderNode:selectingBookmark:]) and store it as an instance variable on the coordinator. Compare the current URL against this presentation-time snapshot inside openURLInCurrentTab:urlBeforeDismissal: rather than using a tap-time snapshot.
Evaluated with Chrome root at commit: 5133b93d189b383c37805b1cf3a9d2dbfe8d7379
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 UXSS guard snapshots the active tab's URL when the bookmark is tapped rather than when the bookmarks sheet is presented, so a background navigation between those moments makes the comparison trivially true.
Impact
A malicious page could potentially run script in the context of another origin the user is logged into, but the text notes the steps are deduced from static analysis and no dynamic proof of concept was run.
What the attacker needed
Chrome for iOS; a saved javascript: bookmarklet; victim opens bookmarks on a malicious page; page navigates while the sheet is open
The fix
The URL snapshot should be captured when the bookmarks sheet is presented and compared against that presentation-time value instead of a tap-time one.
How it was found
- The user has a saved javascript: bookmarklet and is on an attacker page.
- The user opens the bookmarks menu, shown as a form sheet over the still-running page.
- The background page navigates to a target origin while the sheet is open.
- The user taps the bookmarklet, and the URL snapshot is taken after the navigation.
- The URL comparison passes and the script runs in the target origin's context.
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 saved bookmark that runs a small script instead of opening a page. Chrome tries to stop such scripts from running on a site the user did not intend, by checking the page address at the moment the bookmark is tapped. Here the page could quietly change address while the bookmarks menu was open, so the check compared the new address with itself and passed, letting the script run on the wrong site.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.