Executing JS on addons.mozilla.org using webRequestBlocking
A malicious browser extension could inject JavaScript into the addons.mozilla.org website by using the webRequest API to modify responses, bypassing the usual restriction that prevents extensions from running code on that site. This allowed an attacker to execute arbitrary JavaScript in the context of the addons site.
Originally disclosed on Mozilla
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 3 months
Created attachment 8939027
POC.zip
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36
Steps to reproduce:
1. Install attached PoC
Actual results:
https://addons.mozilla.org is opened and then using browser.webRequest.filterResponseData we filter the script loading of google-analytics injecting it with our own code.
Expected results:
Usually when you mention "<all_urls>" within the manifest permission you still can't execute JS on the addons website, but for some reason webRequest doesn't perform this check.
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 webRequest API did not check whether the target URL was a restricted site (addons.mozilla.org) before allowing response modification, unlike other extension APIs that enforce the restriction.
Impact
A malicious extension could execute arbitrary JavaScript on addons.mozilla.org, potentially compromising user accounts or data on that site.
What the attacker needed
Victim installs a malicious extension; extension has webRequest permission
How it was found
- Install the provided proof-of-concept extension.
- The extension opens addons.mozilla.org.
- It uses webRequest.filterResponseData to intercept the google-analytics script.
- It injects its own code into that script response.
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.
Browser extensions can ask for permission to access all websites, but some sensitive sites like addons.mozilla.org are supposed to be off-limits. This report shows that a particular extension feature (webRequest) did not enforce that restriction, so a malicious extension could run its own code on that site.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.