DownloadHelper.js in Firefox for iOS leaks cross-origin download URLs
A download helper script in Firefox for iOS ran in every frame and relied on the page's own startsWith function, so a parent page could override that function and capture the contents of blob: downloads triggered in cross-origin subframes. An attacker could therefore steal data that a victim downloaded from a different origin embedded in the attacker's page.
Originally disclosed on Mozilla
- Fixed in 3.6 years
- Paid in 3 months
- Disclosed after 3.6 years
Created attachment 9194815
blob_url_leakage.gif
`DownloadHelper.js` is a javascript used for downloading content of `blob:` URLs in web pages.
When downloading a `blob:` URL, this handler is executed in WKWebView and the handler gets the corresponding content of given `blob:` URL.
The handler is executed regardless of frames. If a `blob:` URL is downloaded in a subframe of a page then the handler in the parent window is called.
This behavior can be abused for stealing downloaded URLs in cross-origin subframes.
Actual attack is that the handler uses `startsWith` function of a page.
https://github.com/mozilla-mobile/firefox-ios/blob/ca2f5c98dd25b8f3026b2bd976450edff1853172/Client/Frontend/UserContent/UserScripts/AllFrames/AtDocumentStart/DownloadHelper.js#L30
So if a parent window manipulates `startsWith` in a page, download contents in cross-origin subframes are stolen.
The PoC of the attack is below.
http://csrf.jp/2020/download_handler_injection_cross_origin_data_leakage2.html
The attached animated GIF file also shows the attack.
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 download handler ran in all frames and called the page-controlled startsWith function instead of a trusted built-in, letting a parent page intercept blob: download contents from cross-origin subframes.
Impact
Downloaded content from a cross-origin subframe could be stolen by the embedding page, breaking the same-origin boundary.
What the attacker needed
Victim visits attacker's page; attacker page frames a cross-origin site; a blob: download occurs in the subframe
How it was found
- Open the attacker's page, which embeds a cross-origin page in a subframe.
- The attacker's page overrides the startsWith function.
- A blob: URL is downloaded inside the cross-origin subframe.
- The handler runs in the parent window and the overridden function captures the download contents.
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 blob URL is a temporary link to data held in the browser, often used for downloads. Firefox for iOS used a helper script to fetch that data, and the script called a function (startsWith) that belongs to the web page itself. Because a page can replace that function with its own version, the page could watch and copy downloads made inside another site shown in a frame on that page.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.