Firefox Account command handler can be called from any origin
The Firefox Account sign-in webview's native message handler did not verify the origin of the calling page, so any content loaded in that webview could invoke the login command. An attacker who got their own page loaded in the webview could push their own account credentials into the victim's Firefox, effectively linking the victim's browser to the attacker's account.
Originally disclosed on Mozilla
- Fixed in 21 days
- Paid in 48 days
- Disclosed after 21 days
Created attachment 8779613 reproduced.png
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7
Steps to reproduce:
Account command handler doesn't check caller's origin (see following code) so any websites can call it. https://github.com/mozilla/firefox-ios/blob/master/FxAClient/Frontend/SignIn/FxAContentViewController.swift#L142
This handler is shown only in a special webview that is used for Firefox Account sign-in, but the webview still can open untrusted contents in some ways. The attacker can set his/her accounts to a victim's Firefox by invoking "Login" command with "accountCommandHandler" interface through malicious contents he/she sets.
Actual results:
- Tap "Sign In to Firefox" button in Settings menu and launch Firefox launch screen
- Tap "Terms of Service" -> tap "Mozilla Privacy Policy" -> tap link of "Creative Commons license"
- http://creativecommons.org can be loaded on the special webview that page is hosted by third-party and through plain text http: channel
- If following JS code is injected from the attacker
var json = {"detail":{"bubbles":true,"data":{"customizeSync":false,"sessionToken":"","keyFetchToken":"","verified":true,"unwrapBKey":"**","email":"[address removed]","uid":"","verifiedCanLinkAccount":true},"command":"login"},"type":"FirefoxAccountsCommand"} webkit.messageHandlers.accountsCommandHandler.postMessage(json); }
Here attacker's sessionToken, keyFetchToken and uid can be obtained from a response of following request beforehand. https://api.accounts.firefox.com/v1/account/login?keys=true It seems parameter unwrapBKey is not required.
The attached is a picture when reproduced.
Expected results:
Account command handler should not be accessed from third-party resources.
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 native message handler accepted account commands from any page loaded in the sign-in webview without validating the sender's origin.
Impact
An attacker could link a victim's Firefox to the attacker's account, and the report notes the webview can only open untrusted content in some ways, so the attack depends on getting such content loaded.
What the attacker needed
Victim opens sign-in webview; attacker content loads in webview; attacker has own Firefox account
The fix
The account command handler should reject commands that do not come from trusted first-party resources.
How it was found
- Open Settings and tap the sign-in button to launch the Firefox Account screen.
- Follow the Terms of Service link, then the privacy policy link, then the Creative Commons license link.
- The third-party site loads inside the special webview over plain HTTP.
- Injected script on that page posts a login command to the accounts message handler.
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.
A webview is a small browser window embedded inside an app. The app listens for messages from the page inside it, and here it never checked which page was sending them. So a page the attacker controls could send a 'log in' message and make the app sign in to the attacker's account instead of the user's.
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.