Logic error in OAuth redirect validation allows cross-window interception with launchWebAuthFlow
A logic error in Firefox's OAuth redirect validation allowed an attacker-controlled tab to prematurely resolve an extension's OAuth flow by fetching the extension's predictable redirect URL. This could let the attacker supply a malicious OAuth code, binding the user's session to the attacker's account.
Originally disclosed on Mozilla
- Fixed in 10 days
- Paid in 12 days
- Disclosed after 10 days
Vulnerability Details
A logic error in the redirect validation guard allows an attacker-controlled tab to prematurely resolve OAuth flows by issuing a fetch() request to the extension's predictable redirect URL. The incorrect AND condition treats channels from any tab as valid if they have a browserElement, allowing cross-window interception.
Impacted code:
// toolkit/components/extensions/parent/ext-identity.js:79-84
if (
!wrapper.browserElement && // Logic error: should be OR, not AND
wrapper.browserElement !== window.gBrowser.selectedBrowser
) {
return;
}
Reproduction Steps
- Install a WebExtension that uses
browser.identity.launchWebAuthFlowand initiate OAuth sign-in to open the popup. - In an attacker-controlled tab, execute
fetch("https://<extension-hash>.extensions.allizom.org/?code=malicious")using the extension's predictable redirect domain. - The OAuth popup closes immediately and
launchWebAuthFlowresolves with the attacker's URL.
Impact
- Account binding: Extension receives attacker-controlled OAuth code/tokens, binding user session to attacker's account
- Data exfiltration: User data synced after "sign-in" goes to attacker's remote account
- Session fixation: User operates under attacker's account context within the extension
Tested on:
- Mozilla Firefox 144.0.2 (aarch64)
- Mozilla Firefox 146.0a1
Best regards, Igor Morgenstern Aisle Research
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 redirect validation used a logical AND instead of OR, so a request from any tab with a browserElement was accepted rather than only the selected browser.
Impact
The extension could receive an attacker-controlled OAuth code or tokens, binding the user's session to the attacker's account, exfiltrating synced data, or fixing the session under the attacker's context.
What the attacker needed
A WebExtension using launchWebAuthFlow; Attacker can run script in a tab; Predictable extension redirect domain
How it was found
- Install a WebExtension that uses browser.identity.launchWebAuthFlow and start OAuth sign-in to open the popup.
- In an attacker-controlled tab, send a fetch request to the extension's predictable redirect URL with a malicious code.
- The OAuth popup closes and launchWebAuthFlow resolves with the attacker's URL.
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 browser extension signs you in to a service, it waits for the service to send back a special code to a known address. This report found that a malicious website could send a fake code to that address first, so the extension would accept the attacker's sign-in instead of yours. That could make the extension think you are logged in as the attacker.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.