Leak of post-redirect url in error stacktrace when script loaded via importScripts in Web Workers
A Web Worker on one domain can load a script from another domain via a redirect, and if that script throws an error, the error stack trace reveals the full post-redirect URL, including any sensitive tokens in it. An attacker controlling the first domain could therefore learn secrets that the redirecting domain intended to keep private.
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 3 months
Created attachment 9145206
screenshot_013.png
Hello. I found the way how to owner of "a" domain can know the post-redirect URL, loaded from "b" domain.
Here is the example: https://obmi.me/pocs/webworkerexample_5b52f35f-807f-4255-8429-f61a588f404c
The scenario:
1. The page in domain 'a.com' has a Web Worker.
2. The worker calls importScripts function with the link to the redirector page in domain 'b.com'
3. The redirector in 'b.com' domain returns a redirect to the valid javascript script with sensitive data in url, like authorization token, csrf token, etc. (It's popular flow in many websites)
4. The worker calls some function from loaded script, which throws an error and catch it via 'try{...}catch(e){}'
AR: The 'e.stack' property contains the full url of the script loaded from 'b.com' and contains the sensitive data.
ER: ??? Maybe 'e.stack' must contain the first url (which was used as argument in importScripts call) or cutted url.
Reproduced in Firefox 75.0
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 browser's error stack trace records the final URL after redirects instead of the original URL passed to importScripts, exposing sensitive query parameters.
Impact
An attacker who controls the first domain could learn sensitive tokens embedded in the post-redirect URL of a script loaded from another domain, potentially leading to account compromise.
What the attacker needed
Victim visits attacker-controlled page; target site uses redirects with secrets in URL
How it was found
- Create a page on domain a.com that uses a Web Worker.
- In the worker, call importScripts with a URL pointing to a redirector on domain b.com.
- Make the redirector on b.com redirect to a JavaScript file whose URL contains sensitive data such as an authorization token.
- In the worker, call a function from the loaded script that throws an error, and catch it with try/catch.
- Observe that the caught error's stack property contains the full post-redirect URL with the sensitive data.
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 a web page uses a worker to load code from another site, that site might redirect to a final address that includes a secret token. If the loaded code causes an error, the browser's error message can include that final address, leaking the secret to the page that started the worker.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.