Inappropriate implementation in Chrome for iOS (CVE-2026-17762)
A logic flaw in Chrome for iOS causes the image-fetching script for context-menu actions to always run in the main frame, even when the image is inside a cross-origin iframe. An attacker-controlled main page can intercept the fallback network request with a Service Worker, leaking the cross-origin image URL and spoofing the image that is copied or saved.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
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 logic flaw in iOS Chrome's context menu image fetching unconditionally executes retrieval JavaScript in the main frame. If a user interacts with an image in a cross-origin iframe, an attacker-controlled main frame can intercept the fallback network request via a Service Worker. This leaks the cross-origin image URL and allows the attacker to spoof the image data that is copied or saved.
Affected files:
ios/chrome/browser/web/model/image_fetch/image_fetch_java_script_feature.mmios/chrome/browser/web/model/image_fetch/resources/image_fetch.tsios/chrome/browser/web/model/image_fetch/image_fetch_tab_helper.mmios/web/public/ui/context_menu_params.h
Estimated timestamp from git blame: Unknown (Google3 checkout)
Description
A logic flaw in the image fetching mechanism for context menu actions on iOS allows for cross-origin information leaks and UI spoofing. When a user interacts with an image via the context menu (e.g., 'Copy Image' or 'Save Image'), the browser attempts to retrieve the image data using a combination of native code and injected JavaScript.
The vulnerability resides in ImageFetchJavaScriptFeature::GetImageData, which is responsible for injecting the JavaScript retrieval script. It unconditionally targets the main frame of the WebState:
void ImageFetchJavaScriptFeature::GetImageData(web::WebState* web_state,
int call_id,
const GURL& url) {
web::WebFrame* main_frame = GetWebFramesManager(web_state)->GetMainWebFrame();
if (!main_frame) {
return;
}
// ...
CallJavaScriptFunction(main_frame, "imageFetch.getImageData", parameters);
}
If the image being interacted with is located within a cross-origin iframe, the retrieval script (image_fetch.ts) is still executed in the context of the main frame (albeit in an isolated world).
The script first attempts to find the image in the frame's document.images to draw it to a canvas. Because the script runs in the main frame, it cannot find the image residing in the subframe. It then falls back to performing an XMLHttpRequest (XHR) for the image URL.
Potential Exploitation Steps
An attacker can exploit this by setting up a malicious main page embedding a cross-origin victim iframe. Note that these are suggested steps based on code analysis, as our tooling agent cannot execute code.
- Setup: The attacker hosts a malicious website and registers a Service Worker that listens for
fetchevents. - Embed Target: The page embeds a cross-origin iframe (e.g.,
https://victim.com) containing a sensitive image (e.g.,https://victim.com/image.png?token=secret). - Interaction: The attacker uses clickjacking to trick the user into long-pressing the sensitive image and selecting 'Copy Image' or 'Save Image'.
- Flawed Injection: The native code calls
ImageFetchJavaScriptFeature::GetImageData, which injectsimageFetch.getImageDatainto the main frame. - Fallback Triggered: The script fails to find the image in the main frame's DOM and initiates an XHR to
https://victim.com/image.png?token=secret. - Interception & Leak: Because the XHR is initiated by the main frame, it is intercepted by the attacker's Service Worker. The Service Worker accesses
event.request.url, successfully leaking the cross-origin URL (including any sensitive tokens) to the attacker. - UI Spoofing: To perform UI spoofing, the Service Worker responds to the intercepted fetch event with a synthesized, attacker-controlled image blob and a wildcard CORS header (
Access-Control-Allow-Origin: *). - Completion: The XHR completes successfully. The script base64-encodes the attacker's spoofed blob and sends it back to the native C++ browser process, which proceeds to copy or save the spoofed image instead of the original.
Suggested Fix
- Update
web::ContextMenuParamsto include theframe_idof the frame where the context menu was triggered. - Modify
ImageFetchJavaScriptFeature::GetImageDatato utilize thisframe_idto retrieve the correctweb::WebFrameviaGetWebFramesManager(web_state)->GetFrameWithId(...). - Execute the JavaScript only within the context of the specific frame that originated the interaction, ensuring the DOM lookup succeeds and any fallback requests are properly scoped to the correct origin.
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
Likely the native code always targets the main frame instead of the frame that owns the context-menu interaction, so the fallback request is made from the wrong origin.
Impact
An attacker could leak a cross-origin image URL, including sensitive tokens, and could cause a spoofed image to be copied or saved instead of the original.
What the attacker needed
Chrome for iOS; attacker-controlled main page; victim long-presses image in cross-origin iframe; attacker registers a Service Worker
The fix
The context-menu parameters should carry the frame ID, and the image-fetch script should be executed only in that specific frame.
How it was found
- The attacker hosts a malicious page and registers a Service Worker that listens for fetch events.
- The page embeds a cross-origin iframe containing a sensitive image.
- The attacker uses clickjacking to make the user long-press the image and choose Copy Image or Save Image.
- The native code injects the image-fetch script into the main frame.
- The script cannot find the image in the main frame and falls back to an XHR for the image URL.
- The attacker's Service Worker intercepts the XHR, reads the URL, and can return a spoofed image.
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 long-press an image in Chrome on iOS to copy or save it, the browser runs a small script to fetch the image. This report says that script always runs in the top-level page, not in the frame where the image actually sits. If the top-level page is controlled by an attacker, it can watch that fetch and see the image's address, or swap in a different image.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.