activeTab permission allows executing scripts on pages it shouldn't
A browser extension API that injects scripts into pages was blocked when called from a normal background script but not when called from a browser action popup script, so a popup could inject code into internal browser pages such as the cache page and other extension pages. An attacker able to get a user to install a malicious extension could run script in contexts the API documentation says should be off limits.
Originally disclosed on Mozilla
- Fixed in 28 days
- Paid in 14 months
- Disclosed after 28 days
Created attachment 8943569
POC.zip
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Steps to reproduce:
-----Originally reported in bug 1429881#c2-------
browser.tabs.executeScript is blocked from running in 'about:cache' IFF coming from extensions normal background script. However, I noticed that the same is not true if executeScript is called from a browserAction popup script.
1. Install attached PoC extension
2. Navigate to 'about:cache' (or just a new tab/home)
3. Click on browser action button (top right green widget)
According to https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/executeScript
"You can only inject code into pages whose URL can be expressed using a match pattern: meaning, its scheme must be one of "http", "https", "file", "ftp""
Though there is clearly an exception somewhere for browserAction popup scripts.
Actual results:
We can execute script on 'about:cache' as well as other extension pages. Scripts are _not_ executed on privileged pages. (such as about:addons)
Expected results:
Both instances should be blocked
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 permission check for script injection was applied to background-script callers but not to callers running inside a browser action popup, leaving an inconsistent enforcement path.
Impact
Script could be injected into internal browser pages and other extension pages, though privileged pages such as the add-ons manager still blocked it.
What the attacker needed
Victim installs a malicious extension; user clicks the extension's toolbar button
How it was found
- Install the proof-of-concept extension.
- Open the internal cache page, or just a new tab.
- Click the extension's toolbar button.
- Observe that script runs on the internal page.
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 the browser to run a small piece of code inside a web page, which is powerful. The rules say this should only work on ordinary web pages, not on the browser's own internal pages. The report shows that when the request came from a popup window attached to the extension's toolbar button, the browser forgot to apply that rule, so code ran on internal pages too.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.