'Authentication Required' dialogue being application modal produces a vector for attack
Categories
(Firefox :: Security, defect, P1)
Tracking
()
People
(Reporter: barberio, Assigned: johannh)
References
(Blocks 2 open bugs, )
Details
(Keywords: csectype-dos, sec-want, Whiteboard: [sg:dos][adv-main66-])
Attachments
(3 files)
(deleted),
image/png
|
Details | |
(deleted),
text/x-phabricator-request
|
lizzard
:
approval-mozilla-beta+
|
Details |
(deleted),
text/x-phabricator-request
|
lizzard
:
approval-mozilla-beta+
|
Details |
Updated•17 years ago
|
Updated•17 years ago
|
Updated•17 years ago
|
Reporter | ||
Comment 2•17 years ago
|
||
Reporter | ||
Comment 3•16 years ago
|
||
Comment 4•14 years ago
|
||
Comment 5•12 years ago
|
||
Reporter | ||
Comment 6•12 years ago
|
||
Comment 7•11 years ago
|
||
Comment 9•7 years ago
|
||
Reporter | ||
Comment 10•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Comment 14•7 years ago
|
||
Comment hidden (advocacy) |
Assignee | ||
Comment 17•7 years ago
|
||
Reporter | ||
Comment 18•7 years ago
|
||
advocacy-reviewed |
Assignee | ||
Comment 19•7 years ago
|
||
follow-up-to-spam |
Reporter | ||
Comment 20•7 years ago
|
||
advocacy-reviewed |
Updated•7 years ago
|
Comment 21•7 years ago
|
||
Comment 22•7 years ago
|
||
Comment hidden (advocacy) |
Comment 26•7 years ago
|
||
Comment hidden (off-topic) |
Comment hidden (advocacy) |
Comment 31•6 years ago
|
||
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Comment 37•6 years ago
|
||
I've looked into this a bit with the intent of coming up with a short term fix. I'll summarize the state of this issue and chart a path forward for the short and long term:
The issue
The basic auth prompt in Firefox is window modal and blocks the entire browser from being interacted with when open. This can be easily abused by websites to effectively prevent users from using Firefox ("DOS"). It is made extra bad by the fact that the dialog shows a credentials field and that websites can provide a message to the user. This is often combined with locking the user in DOM fullscreen, auto-playing sound and offering extension installs to "fix" some "virus".
This bug has gone unsolved for a long time because a previous attempt at short term mitigation failed (bug 1312243) and other possible solutions pose a significant engineering challenge that no team of experienced Firefox engineers has been resourced to work on.
Proposed short term mitigation
The fix in bug 1312243 introduced a maximum of three consecutive cancelations (controlled by a pref) that a user could perform until Firefox would prevent the page from showing more dialogs.
This, in my opinion, is a great idea. The implementation, however, has a major fallacy: It checks the inner window id in the well-meaning attempt to find user navigation or reloads and clears its internal counter when that window id changes. Unfortunately this also clears the counter on non-user-initiated navigations and reloads. I believe that the true intention of the patch was to cancel the auth dialog after 3 attempts, except if:
- The user reloads the page on their own terms
- The user navigates to a different site on their own
Which is what I plan to implement, using the same pattern we applied to implement temporarily blocked site permissions:
- Temporarily store basic auth counter state on the browser object, as a map from baseDomain (eTLD+1) to number of cancellations
- Reset this state only on user initiated reload
- Reset the counter for a domain if the user has entered login data into the dialog and submitted
This would mitigate the DOS issue while hopefully not breaking any sites that rely on basic auth.
In addition to that, we plan to put in place other short-term mitigations for the abuse of DOM fullscreen, specifically in combination with showing prompts like the auth prompt, extension install prompts or permission prompts.
Long term solution
While the above proposal does help against a DOS attack, the simple fact that a website can spawn an application modal dialog that forces you to enter your credentials is, to say the least, not optimal. To properly and finally solve the full extent of this issue, there are two more bugs we need to tackle:
- Bug 1426656, which would add a "Prevent this website from showing auth dialogs" checkbox to the auth dialog, making it clearer to the user that this isn't something they have to put up with (similar to the alert() dialog)
- Bug 613785, which makes the auth dialog tab modal.
Comments appreciated.
Assignee | ||
Comment 38•6 years ago
|
||
The fix in bug 1312243 introduced a maximum of three consecutive cancelations (controlled by a pref) that a user could perform until Firefox would prevent the page from showing more dialogs.
This, in my opinion, is a great idea. The implementation, however, has a major fallacy: It checks the inner window id in the well-meaning attempt to find user navigation or reloads and clears its internal counter when that window id changes. Unfortunately this also clears the counter on non-user-initiated navigations and reloads. I believe that the true intention of the patch was to cancel the auth dialog after 3 attempts, except if:
- The user reloads the page on their own terms
- The user navigates to a different site on their own
Which is what I plan to implement, using the same pattern we applied to implement temporarily blocked site permissions:
- Temporarily store basic auth counter state on the browser object, as a map from baseDomain (eTLD+1) to number of cancellations
- Reset this state only on user initiated reload
- Reset the counter for a domain if the user has entered login data into the dialog and submitted
This would mitigate the DOS issue while hopefully not breaking any sites that rely on basic auth.
Assignee | ||
Comment 39•6 years ago
|
||
Matt, I'll look into testing this tomorrow, feel free to go slow on the review. I just wanted to have the patch up for feedback quickly.
Comment 40•6 years ago
|
||
(In reply to Johann Hofmann [:johannh] from comment #37)
I think on the whole this is the right approach. I would actually propose we set the limit to 1 dialog, not 3. If the user needs that dialog they can refresh and/or actually input something, which would reset the counter. One other thing:
- Bug 613785, which makes the auth dialog tab modal.
Comments appreciated.
bug 613785 comment 21 is still applicable, it seems, in that we'd need to ensure that things work correctly when http auth blocks blocking resources. I suspect that's the hard part, IIRC making the dialog tab-modal could in theory be done just by passing the right "allow tabmodal" bool via the propbag given to the alerts service.
Assignee | ||
Comment 41•6 years ago
|
||
(In reply to :Gijs (he/him) from comment #40)
(In reply to Johann Hofmann [:johannh] from comment #37)
I think on the whole this is the right approach. I would actually propose we set the limit to 1 dialog, not 3. If the user needs that dialog they can refresh and/or actually input something, which would reset the counter.
Yeah, I actually agree with you but I think there are folks who don't. Maybe an IRC/vidyo conversation can help clear this up, and I think we should defer it to another bug and start a conversation there. 3 is a very good start if it's properly enforced.
- Bug 613785, which makes the auth dialog tab modal.
Comments appreciated.
bug 613785 comment 21 is still applicable, it seems, in that we'd need to ensure that things work correctly when http auth blocks blocking resources. I suspect that's the hard part, IIRC making the dialog tab-modal could in theory be done just by passing the right "allow tabmodal" bool via the propbag given to the alerts service.
Yes, I still believe that making the dialog tab modal is the end game for this issue, but this is sort of what I was referring to when I wrote about technical complexities that prevent a faster solution. I think in this case it boils down to the "blocking subresources" thing and also the fact that showing an auth dialog completely in content land, without overlapping chrome, might not be something we want to do. The WebPayments team had a POC for a dialog that prevents these two issues AFAIK but it's just not a short term solution.
Assignee | ||
Comment 42•6 years ago
|
||
Comment 43•6 years ago
|
||
Comment 44•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d05f776eb840
https://hg.mozilla.org/mozilla-central/rev/cf32e70c234f
Updated•6 years ago
|
Comment 45•6 years ago
|
||
I don't think bug 1525267 is related. That's a different issue altogether.
Updated•6 years ago
|
Assignee | ||
Comment 46•6 years ago
|
||
Now that bug 1525267 is fixed we figured we could go for a late 66 uplift, considering that this is being exploited in the wild.
Assignee | ||
Comment 47•6 years ago
|
||
Comment on attachment 9039990 [details]
Bug 377496 - Improve auth dialog blocking heuristics. r=MattN
Beta/Release Uplift Approval Request
- Feature/Bug causing the regression: None
- User impact if declined: Fake malware sites blackmail users into giving out their credentials, installing real malware, and/or calling expensive "support" hotlines.
I'm sure you've seen one of those.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: It might be nice to do a QA round of sites that require basic auth (though I'm not aware of any). They should still function.
- List of other uplifts needed: Bug 1525267
- Risk to taking this patch: Medium
- Why is the change risky/not risky? (and alternatives if risky): This patch had a lot of bake-time and should be quite safe to take, but we moved a few things around in bug 1525267, which didn't have as much bake. Overall I think given the fact that this is actively being exploited in the wild it could be worth taking the small risk.
- String changes made/needed: None
Comment on attachment 9039990 [details]
Bug 377496 - Improve auth dialog blocking heuristics. r=MattN
Has test coverage, security improvement for users, let's give it a try.
Comment 49•6 years ago
|
||
bugherder uplift |
Updated•6 years ago
|
Updated•6 years ago
|
Comment 50•6 years ago
|
||
I was able to reproduce the issue on older Beta (20190128143734) and Firefox release builds using the steps from comment 36.
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
The issue is verified as fixed on the latest Beta 67.0b7 (20190331141835) and Firefox 66.0.2 (20190326175229). The authentication prompt isn't displayed after the third attempt to accept or dismiss it.
Comment 51•5 years ago
|
||
As of Firefox 73.0, it's back, and being actively used in an attack right now. Ubuntu Linux 18.04 LTS.
See image: https://i.imgur.com/EOUCK0i.png
This is coupled with an attack which uses large amounts of memory in the browser. So, even though Firefox offers the option to stop the page, you can't click on it because the basic authentication prompt blocks other interaction.
Repeated clicking on the "cancel" button for the basic authentication prompt does not dismiss it.
Comment 52•5 years ago
|
||
Note: someone has purchased a large number of Bing keywords leading to the attack site, including "firefox bug", so this is going to have some current impact.
Comment 53•5 years ago
|
||
(In reply to John Nagle from comment #52)
Note: someone has purchased a large number of Bing keywords leading to the attack site, including "firefox bug", so this is going to have some current impact.
Can you please open a new bug blocking this one using this URL and putting some info in there - such as the URL of the website where it happens?
Thanks!
Comment 54•5 years ago
|
||
As requested, opened a new bug at:
https://bugzilla.mozilla.org/show_bug.cgi?id=377496
Attack page redirects to http://165.22.224.156
Comment 55•5 years ago
|
||
(In reply to John Nagle from comment #54)
As requested, opened a new bug at:
I think you pasted the wrong bug 🙂
The new bug is:
https://bugzilla.mozilla.org/show_bug.cgi?id=1616126
Comment 56•5 years ago
|
||
Gosu is right; new bug is at https://bugzilla.mozilla.org/show_bug.cgi?id=1616126
Comment hidden (off-topic) |
Updated•5 years ago
|
Description
•