Skip to content
OAuth / SSO Disclosed report Intermediate CVE-2020-6823

browser.identity.launchWebAuthFlow() exposes redirect_url no matter what it is.

Firefox's browser.identity.launchWebAuthFlow() resolves with the final redirect URL even when that URL is not the add-on's own redirect URL. An attacker who knows a registered redirect_uri for an OAuth app can create a malicious add-on, trigger the flow, and obtain the authorization code from the redirect URL.

Leon Visscher Follow

Originally disclosed on Mozilla

  • Fixed in 7 days
  • Paid in 12 days
  • Disclosed after 7 days
Text
browser.identity.launchWebAuthFlow() always returns the URL to where is redirected in the opened webview. This is a big security issue.

When a Firefox Add-On uses the browser.identity.launchWebAuthFlow() method, the service provider's authorization URL is passed as mandatory parameter. This URL contains among other things the redirect_uri to where the service provider should redirect the user after the user has authenticated at the service provider. The authentication part of the OAuth flow all happens in a webview that Firefox automatically launches after calling launchWebAuthFlow().

The redirect_url used, should be a registered, and thus known, url at the service provider.

This redirect_url can be the url of the add-on itself (obtained by browser.identity.getRedirectURL()), in which case the user will be redirected back to the Add-On. This redirect_url can also be something else.

The current behaviour in Firefox is that the Promise returned by browser.identity.launchWebAuthFlow(), always resolves with the URL to where is redirected. Also in the case this redirect_url is not the same url as obtained by browser.identity.getRedirectURL() (the Add-On url). The result is that I can obtain the code passed in the redirect_url's queryparams, even when the redirect goes to another domain. 

Possible exploit:
An attacker can exploit this when he/she knows at least 1 registered redirect_url of an app that uses OAuth (which does not have to be under his control). He can just call the browser.identity.launchWebAuthFlow("https://auth.service.provider.com/oauth/authorize?client_id=ClientId&redirect_uri=https://the.registered.redirect_uri.org/") with given parameter. It doesn't matter where the service provider redirects the users after authenticating, the Promise returned by browser.identity.launchWebAuthFlow() resolves with the redirect URL, containing the auth_code (assuming the user authenticated correctly)

How to reproduce:
1. Setup up basic OAuth 2 server
2. Register a redirect_uri at the server

Step 1 and 2 represent the OAuth server of an existing (not our own) application

Next steps are the Attackers actions:

3. Make a new Firefox Add-On (only valid manifest.json and background page necessary)
4. Call browser.identity.launchWebAuthFlow({url: "https://authserver.com/auth?redirect_uri=https://the_registered_redirect_url.com&client_id=registeredClientId", interactive: true}).then((url)=>{console.log(url)})
5. Authenticate correctly with OAuth app
6. See the redirect_url logged in console.

Using this method the Attacker can counterfeit an Add-On, and use the same redirect_uri as the real Add-On. But after the redirect, use the Auth code obtained. Even though the Add-On's0 id is not registered at the service provider.

The original report as published on Mozilla's Bugzilla, by Leon Visscher. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 API does not check that the final redirect URL matches the add-on's own redirect URL before resolving the promise.

Impact

An attacker could obtain an OAuth authorization code for another application's registered redirect URI, even though the attacker's add-on ID is not registered with the service provider.

What the attacker needed

Firefox add-on using launchWebAuthFlow; Attacker knows a registered redirect_uri; Victim authenticates in the flow

The fix

The API should only resolve with the redirect URL when it matches the add-on's own redirect URL obtained from browser.identity.getRedirectURL().

How it was found

  1. Set up a basic OAuth 2 server and register a redirect_uri.
  2. Create a new Firefox Add-On with a manifest and background page.
  3. Call browser.identity.launchWebAuthFlow with the authorization URL containing the registered redirect_uri and client_id.
  4. Authenticate correctly with the OAuth app.
  5. Observe the redirect URL, including the authorization code, logged in the console.

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.

OAuth is a way for apps to let you sign in with another service without sharing your password. When you sign in, the service sends a short-lived code back to a specific address called a redirect URL. This report says Firefox's add-on login helper gives that code back to the add-on even when the address belongs to a different app, so a malicious add-on could steal the code and use it.

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.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

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.