Open Bug 1967681 Opened 1 year ago Updated 1 month ago

"Reveal Password" context-menu item does not ask for OS auth or PrP

Categories

(Toolkit :: Password Manager, defect, P3)

defect

Tracking

()

People

(Reporter: simonf, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: sec-want)

Right clicking on the password box and selecting "Reveal Password" makes a cleartext password available without OS auth or PrP from the user.

Note: This may be a dupe. I thought we already had it on file but cannot find another bug.

We just tested this on nightly and release, and it indeed asks for OS authentication before revealing the password. Also, from my memory, I have seen the PrP prompt on nightly, too.

Could you please provide more information? On which version did you encounter this?

Flags: needinfo?(sfriedberger)

This is about the context menu entry "Reveal Password" on password boxes.

Flags: needinfo?(sfriedberger)
Severity: -- → S3
Priority: -- → P3

Note, opening devtools and executing something like document.getElementById("password").value will also reveal the password but does require a bit more expertise. Another fine line.

Duplicate of this bug: 2014982
Duplicate of this bug: 2016257
Keywords: sec-want

This feature was added in Firefox 96 (bug 502258)

See Also: → 502258

@Johannes and Daniel: Thank you to find related issues and duplicates.

I think we should distinguish two use cases:

  1. The user manually enters a password and wants to check if she has entered it correctly. This case was the reason for bug 502258 (and its duplicates).
  2. The user had previously saved a password in the built-in password manager and wants just use the password to login. Revealing this password is usually not required and should be possible only if the primary password is entered again (i. e. in the context of the revealing request). This case was the reason for this bug (and its duplicates).

A possible solution would be: The <input>-Element gets some extra property ("autofilled" or "autocompleted" or "moz-autofilled") set to true whenever the value is filled by the password manager (but not if the <input>-Element value has been entered manually). Then this property may be tested if "Reveal Password" is clicked in the associated context menu.

The advantage of such a solution would be: Testing the property could help prevent other methods of disclosing stored passwords: In bug 2016257 Aaron Scully described various methods. Also some web-service providers use the "eye"-icon or another button to display the password by changing the "type" attribute from "password" to "text". (That's also fine if the value manually entered, but not if the value is autofilled.) So the revealing can be controlled by testing the proposed "autofilled" property: Accepted if not autofilled, otherwise rejected unless confirmed by the primary password.

(I think it is not possible to prevent any disclosure. At least not without major effects. If a web-app wants to disclose the password then it could do it: For example it can read the value via JavaScript, add a new <input type='text'> element with this password value and delete the <input type='password'> element. Preventing the value of an autopopulated <input type='password'> element from being read would cause web-apps with client-side encryption to stop working.
However it is not necessary to prevent any theoretical method of revealing. It is only necessary to prevent methods controlled by attackers and methods usually allowed by the web services. Since changing the type from 'password' to 'text' is the usual and easiest way to reveal a password it would be adequate to cover that method and the methods decribed by Aaron.)

FYI: In Bug 2014982 I told a rather complicated procedure to reproduce the defect. Simpler (straight forward without any registration) is:

  1. Open a new tab and enter "about:logins"
  2. Click on "+" to the right of the search field
  3. Enter website address "https://webmail.strato.de", username "test" and password "password"
  4. Click "Save"
  5. Click on the "eye" icon to the right of the bullets indicating the password. Expected: Primary password required. That means the password is protected. Do not enter the primary password. Click "Cancel" instead
  6. Click on the URL (https://webmail.strato.de)
  7. Let autofill the credentials for user "test"
  8. Right-click on the password field
  9. Click "Reveal password". It will be revealed although it should be protected against disclosure.

Just to add some further information here. I reported this same issue to Chromium and their response has been what I can only describe as complete apathy. They know about the issue with developer tools and even have documentation about it here where their "security" team details why they won't fix the issue. My opinion is that they do not understand security, nor the different levels at which threats exist, including around opportunity, effort, reward and risk. It's good to see that Mozilla are taking the issue a bit more seriously.

One thing that was mentioned in the lacklustre response to the Chromium issue was that some websites require JavaScript to send the password to login. I'm sure there are plenty of better solutions to this issue, but the one that I thought of would be for the JS engine to refuse to make visible on the page (or via a JS alert or console log) any string that matches a password that is currently being auto-filled by the password manager (this restriction would only apply when the password manager is active on a page and only apply to string/text values that it provides). This would then allow JavaScript to send the password as part of a login process without someone being able to easily reveal it.

The fix wouldn't be about making the solution completely bullet proof, it's just to make it non-trivial for a miscreant with brief access to someone's computer (eg whilst they collect a printout in the office) to access their passwords.

I don't use Safari, but when I tested the same issue in that, Safari seems to require a fingerprint before it populates the password fields. Perhaps a simple PIN could be added to Firefox (separate from the master password) which would need to be entered before each population from the password manager? Though setting that PIN up then puts the burden back onto users and presumably they are using the browser password manager because they value convenience over the security of something like KeePass and wouldn't use the feature.

Thank you, Aaron for your interesting comment.

Regarding the extra PIN: I also think that hardly anyone would use it. I think it's important to find methods that are both convenient and safe.

However your other considerations can help the "assignee" to understand the big picture.

I see that up to now the "assignee" is still unassigned. To ensure that the assignment happens soon it should be clear what is expected. I think this bug addresses simply the "Reveal password" in the context menu. That should be protected by requiring the input of the primary password if the password field had been autofilled.
That would help immediately and make Firefox more secure. I recommend increasing the severity of this bug to S2 immediately. And I recommend increasing the priority to P2 as soon as possible. @Micah: Is this possible?

In the sequel some other related attack vectors (inspect password field and edit "type" attribute, changing the type attribute via JavaScript) should IMHO become the subject of extra bugs. Those may reference this discussion.

@Micah: Do you agree or do you think it's better to prevent the other attack vectors while fixing this bug?

Flags: needinfo?(mtigley)

Hi Aaron, I thought again about the possibility of an extra PIN: An extra PIN is probably a lot of effort (like any additional password). But: You could do it similar to what KeePass for Android does with QuickUnlock: The last three characters of the master password are used to unlock when the database has been opened but locked in the meantime. For Firefox, this could mean, for example, that optional (!) after an adjustable timeout (no keyboard input or mouse clicks), the built-in password manager is locked, but can then be unlocked by entering the last three characters of the master password. But I think that would be an extra "bug", not a defect, but a requirement.

Hi Micah, I asked you two questions 10 days ago in Comment 10 and haven't received an answer yet. If you are not currently available or are not the right person to be asked then you or Johannes, Daniel or another person could give me a hint?

Question 1: Is it possible to immediately increase the severity of this bug to S2 and increase the priority to P2 as soon as possible? Please do not hesitate to ask if you need a detailed justification for this. (I think this bug is a serious security bug without a workaround.)

Question 2: Aaron gave us some other attack vectors (e.g., "inspect item") to expose stored passwords without having to enter the primary password. Should we include such similar (but not the same) attack vectors in this bug 1967681 or create separate bugs? Please feel free to ask if I should tell you the pros and cons of both options.

@daniel: Hi Daniel, I think you should answer the question of Aaron in Comment 2 of the duplicate bug 2016257 explicitly. (I understood your Answer differently than Aaron.)

BTW:

(1) I think, time is an important factor for security. (Attack vector 1 takes only seconds to reveal and photograph a password. Attack vector 3 has the risk that the victim will come back with the coffee and the perpetrator will be caught.)

(2) "KISS" is an important principle for developers. But when it comes to security, it's even more important that it's easy for the user to behave safely. That's why security and usability must go hand in hand. (Therefore my Comment 11. I understand you as follows: The user should enter the full primary password every time she logs in to a web service. But then she would probably use a weak primary password. This would give attackers the chance to decrypt the master password after stealing a data backup.

(3) I know that every software change means a lot of effort. However for the 3 attack vectors the Aufwand should not be excessively high:

  • Fixing vector 1 shouldn't be very difficult (see my Comment 7. Setting a flag or property (and reading that flag later) on input-Elements happens also on other places: Or how else should the context menu of a disclosed password (input[type="text"] after type change from "password" to "text") know that the option "Reveal password" is offered? And that this option should not be offered in the usual context menus of input[type="text"] elements?
  • I think to fix vector 2 the simplest and best solution would be: to require the primary password whenever a Developer Tools window is opened. (That will also prevent to inject or change some JS script to via Developer Tools to reveal input[type="password"] values.)
  • To fix vector 3: Simply check the URL of bookmarklets and disallow "javascript: ...".

(4) The optional timeout and QuickUnlock as suggested in Comment 11 would also help to fix the disadvantage of ignoring "autocomplete='off'". (The introduction of this ignoring years ago was necessary to enforce the will of users over ignorant web services. Because using of password managers increases the security. However:) When a login session expires due to inactivity (think of online banking), auto-filling a login form is not appropriate, but helpful for insider attackers. Together with the measurements in (3) the protection against insider attacks would become optimal.

(5) My proposal to fix vector 1 mitigates also the risk of auto-filled passwords being exposed (not by Firefox, but) by a web service. Google and others optionally display an entered password (and they don't care that this password may not entered manually and should be protected). Protecting the "type" attribute of input[type="password"] elements would cover almost all such cases.

(6) The current situation is critical: Most (I fear almost all) users of the built-in password manager are not aware of the insider attack vectors described by Aaron. Conversely: If they look on about:logins ("Passwords") they are required to enter the primary password in order to reveal a single login password. Also if they use the Developer Tools and try e. g. "Edit HTML" and change the type of a password element from "password" to "text": They see that the password value was discarded. Users that use the password manager do not need to look for a context menu on password fields. That's why only few users are aware of the disclose issue and all the others mistakenly think that the passwords are well protected against disclosure also if the primary password is already entered and why they don't see a big risk if they leave the room only to get a cup of coffee.
For Firefox the first and most urgent measurement should be: Warn the user to leave the workplace without quitting Firefox or lock the PC session once the user has opened the built-in password manager by entering the primary password. This warning should remain in place until the proposed fixes in (3) and (4) are implemented.
A risk usually becomes much more risky if the people concerned are not aware of it. A fence around a property offers at most as much security as its lowest point. And if the owner do not know about the lowest point but the possible attackers know about, then the situation is worst.

(7) Internal attacks are often underestimated. That is in the nature of things. If you didn't trust your spouse or boyfriend or girlfriend, you wouldn't have teamed up at all. However all too often there is domestic violence, including digital violence.
The colleagues are all nice people. However paid spies also behave nicely.
And also the own children sometimes mess things up. Or worse.
Firefox's built-in password manager in principle offers excellent protection against internal attacks, precisely because of the master password protection and the handy auto-fill function. However over time, the protection has become quite patchy without users knowing about it. This is dangerous and should be fixed.

Flags: needinfo?(dveditz)

Sorry for some mistakes in my previous comment:

  • In (3) I have overlooked to translate (the German word) "Aufwand" to "effort"
  • Out of old habit, I wrote somewhere "master password", should be "primary password"
  • In (7) I wrote "Internal attack", but I meant "Insider attack".
  • In (3) I wrote something about input[type="password"] switched to input[type="text"]. That switch happens on web services discussed in (5). But the "Reveal password" via the context menu discussed in (3) lets the type attribute unchanged ("password").

Hi Daniel, I think you should answer the question of Aaron in Comment 2 of the duplicate bug 2016257 explicitly.

done

I understand you as follows: The user should enter the full primary password every time she logs in to a web service. But then she would probably use a weak primary password. This would give attackers the chance to decrypt the master password after stealing a data backup.

yes, my desired state is not realistic -- people will turn the protection off rather than be bothered to enter the password (as seen with the credit-card autofill that originally required it by default). Safari does the equivalent, but Safari only runs on hardware that is capable of quick and easy biometrics (touch ID or Face ID). Firefox would not have a good alternative on computers that didn't have support for that..

Flags: needinfo?(dveditz)

Hi Daniel,
thanks for the Comment 3 on the closed bug 2016257. That clarifies a lot. I think there is a big misunderstanding. You think that we want a solution that destroys functionality in existing web services.

The solution I have in mind will NOT break any functionality if done correctly:

(1) Prerequisite: Input fields [type='Password'] are given a property (e.g.) "autofilled". The default value of this property is: false. If the built-in PW Manager fills in the "value" property, the "autofilled" property should be set to true. If the user clears the password field, the "autofilled" property should be reset to false.

(( (2) Method 1 is now very easy to fix (because of (1)): The "Reveal password" context option is only displayed if the "autofilled" property is true. I think we already agree on this point.))

(3) Regarding method 3: If a user edits a bookmarklet and enters a value for the URL that starts with "javascript:", it should be rejected. (No web services depend on bookmarklets. The bookmarklets are only included in the Firefox user interface. I don't see any functionality in bookmarklet URls that start with "javascript:". This consideration applies only to bookmarklets. Of course, the hyperlinks in the HTML body and all other URLs in the DOM, even in JS scripts, should behave as before. OK? If not, stop here and let's get that straight before we get to method 2.

(4) To Method 2: I agree with you that changing the type attribute of an input element is probably used by many web sites. And it makes sense: If a user types in a password than she must be able to fix a mistyping. And that is only practicable if the password may be revealed.
But for saved passwords (saved by the built-in pw manager) the situation is different. Usually the user knows that the password is correct. There are exceptions: If the password does not work, the user needs to check it: She can enter the URL "about:logins" ("Passwords") in a new tab, select the password entry and click "Show". In this rare cases she need to enter the primary password. So she has the functionality.

Now for the behavior of the web page: Usually (exceptions will be discussed later), the websites have a button (with an "eye" icon) or a checkbox to display the entered (or auto-filled) password. The button or checkbox has an event handler attached to it in JavaScript. This is called when the user calls up the button or icon. And JavaScript now simply changes the type by calling the following function: "function(el){el.type='text';}" Currently, this function changes the value of the type attribute from "password" to "text".

The only change at this point should be:

  • (The following only happens if for an input[type="password"] type is changed. Otherwise, everything remains the same.)
  • el should be checked if the "autofilled" property is true
  • if no (or no primary password is specified): behave as before (change type attribute)
  • if yes: call a function that needs to enter the primary password (or alternatively - if QuickUnlock is implemented and configured - the last characters of it)
  • if the primary password (or its tail, i. e. its last characters) was entered correctly: Behave as before (change type attribute)
  • if the primary password (or its tail) was not entered correctly: Show a message (like alert(...)) and do not change the type attribute. And throw an exception (e.g. "Saved password cannot be revealed").

The only point where something could happen to the website now is: "Throw an exception".

Note: As long as the user enters the correct master password (or in QuickUnlock: the last characters), no bad things happen.

But what happens in the event of an thrown exception? JavaScript programmers are used to receiving exceptions. And to handle them. Exceptions can be captured, analyzed, and logged in the console. Yes, the web developers have to do something (but not much).

What is the work of the web developers:

  • They have to look on the console, recognize the exception and realize that they can't rely on the assumption that changing the "type" attribute is always possible. They will see immediately (from the text of the exception) that the change will only be rejected if the password has been autofilled.
  • If changing the type (el.type="text";) was the first action of the event handler when clicking the "eye" icon, the developers don't need to change anything. (The exception stops the event handler and the "eye" icon remains to be unchanged.)
  • If the button has been changed to the "striked-through eye" icon they need to move that action after the type change.
  • If the type change was attempted after clicking a check box, they must reset the check box after the exception was catched.

(Note: If the type change was from "text" to "password": No change in JavaScript code is required, as hiding a password again is always possible without a primary password or QuickUnlock input.)

That's not really bad. It would be worse to reveal the password to an attacker.

Why an exception should be thrown:

  • Because the web developers must get a chance to know that the revealing did not work. (E. g. the "eye" icon should not be changed to a "striked through eye" icon.)
  • It's easier to try/catch it than to change it and then just spot a mistake by controlling the result.

To minimize the work of the web developers: An info page may be created and a warning in the console should appear whenever a type is changed from "password" to "text".
This allows the developers to program to catch the exception and handling it.
Next step perhaps: the warning should no longer be a "console.log()", but should become a warning unless the exception is caught or the password has been entered manually.
Last step: Activate the throw of the exception.

What happens if the web developers don't adapt their web pages in time:

  • Maybe an "eye" icon will be changed to a "striked through eye"" icon (caused by an incorrectly typed primary password). But the password is not revealed. User workaround: Try clicking on the "striked through eye"" icon again (if the button changes to the "eye" icon) or: Reload the page. Then: Don't click on the "eye" icon or: Enter this time the correct primary password.
  • Maybe a checkbox (to reveal) is ticked. But the password is not revealed. User workaround: Try clicking the checkbox again (should uncheck the box) or: Reload the page. Then: Don't click on the box or: Enter this time the correct primary password.

Daniel, please compare this relatively small amount of work (the description is much more than the actual programming) of web developers with the risk of leaking passwords, and with the amount of work done on many, many websites that do not want the passwords to be revealed. Important websites are: e.g. online banking, web email clients, online password managers that do not use browser extensions, server management, web apps...
Please compare the little mess that could happen (if the web developers don't adapt their web pages in time) with the real mess that users happen if their passwords were stolen by insider attackers...

I did find a solution to prevent disclosing passwords. (With no autocompletion after session timeout, with distinguishing between manually typed and auto-filled passwords, with optionally revealing the former ones, but protecting the latter ones.) But only with much trick programming and obfuscation. And I cannot make my solution open-source, as that would destroy the obfuscation. The only clean fix of this issue (without obfuscation) may be done by Firefox.

Please do not hesitate to ask if there are remaining questions. Or alternative solutions should be discussed. I would also help to create an info page.


FYI:

Why I'm pushing for this solution: I've been working on password security for 15 years and I've been programming web apps (Software as Services) for 20 years. I've learned that when it comes to digital security, password security is the weakest point. And to remedy this, you have to start with people in particular, so that they use a lot of different strong passwords. You can't do that without a password manager. And trust plays a major role here. Without trust, people don't use password managers. And without a password manager, they don't use strong passwords.

When people ask me suspiciously whether the built-in password manager is secure, all I can say at the moment is: As long as you set a strong master password and don't let your workplace out of your sight, yes...

Passkeys will certainly play an important role at some point. Perhaps also replace the mass of Internet passwords. However the problem right now is that you can't easily export them. As long as you doesn't find "Passkeys export" and "Passkeys import" directly in the settings on Windows, there is no certainty that if your PC breaks down tomorrow, you can buy a new one and then import the previously exported passkeys again. I think this is also the reason why passkeys are not yet gaining the necessary acceptance. There is a lack of confidence that you will not lose the passkeys. (Combined with the distrust of a synchronization of devices via the cloud.)

Of course, there are solutions like 1Password supporting passkeys. But it does cost something, not as much as a few years ago, but not everyone just has another 44 euros left over every year in addition to all the other costs for the digital world.

I can usually make passwords as long as I want (i.e. 128 bits strong) and save them in any password manager, I can import and export them into and from Firefox. For example, I can store them in another password manager with accompanying data (such as provided phone number, bank details, etc.) and thus have my collected credentials together. Safe and captive. But daily using the credentials auto-filling by Firefox.

That's why Firefox with its built-in password manager plays a key role for me when I advise people on password security.

Just for your information:

  • This bug was already detected by Kimco on 2023-09-27
  • Earlier (2023-04-12) Vishal Gupta published the article "[Tip] Disable or Remove “Reveal Password” Option in Firefox". Unfortunately the given tip seems not to work any more.
  • I found out that it is possible to bind an event handler with jQuery disabling the contextmenu for input[type='password'] elements:
(function() {
  var stopper;
  stopper = function() { return false;  };
  $( document ).on( 'contextmenu', "input[type='password']", stopper );
}).call(this);

(Hopefully I did no mistyping or other mistake while simplifying and transpiling my actual (tested) script into the written script above.)
That script disables the contextmenu at all. So it is only a quick fix to prevent attack vector 1 (disclosing saved passwords by context menu).

My problem with this issue (being present in the browser) is that it's a bit like a car manufacturer knowing that the brakes on a car don't work under certain circumstances, but just shrugging their shoulders and not fixing the issue. It is absolutely rational for a user to think that a password stored in a browser password manager would be secure. And whilst, without a password on the password manager, it's impossible to guarantee complete physical security for the data in that password manager, it is quite shocking how easy it is to expose that information. I think it would be better to not have the feature than to have one that is so flawed as this. At least then, a user may well look to a more secure alternative, such as KeePassXC.

Summary: "Reveal Password" does not ask for OS auth or PrP → "Reveal Password" context-menu item does not ask for OS auth or PrP

@Aaron: I understand your Comment 18 completely. However there are always pleasant surprises.: 13 years ago I made a comment regarding the implementation of at least TLS 1.1, where it was already discussed for 4 years whether this was necessary because it was not yet widespread on the web servers. (TLS 1.0 had long since been compromised by the BEAST attack vector.) And the administrators of web servers said that the installation of server software with TLS > 1.0 was not so urgent because the browsers were not yet ready. It was like the chicken-and-egg problem. Then the surprise: 14 days after my comment, Adam Langley was named assignee and was able to successfully complete the work 2 years later.

@Daniel: I have good news for you: After I reconsidered my Comment 16 I see an alternative to throw an exception:

Instead to throw an exception:

  • The value of the password field can be cleared and then type attribute change (from "password" to "text") may happen.
  • However accordingly to the POLS/POLA principle the user should be informed, e. g. by means of an alert message ("Autorisation failed. Password value deleted."). In any case, this extraordinary deletion of the password value should be documented in the console log.

If Firefox handles this in this way, no software changes are necessary on the web pages. The value of the password field is revealed (but with an empty value). The real password is not revealed. And the procedure is very similar to the situation where the previous autofill of the password field would not have happened. In fact, this autofill has been reversed.

And the need to enter the primary password (or perform the QuickUnlock) is still kept to a minimum. And a special information page or console logs or warnings that the behavior will change are no longer necessary.

Daniel, I hope this alternative will allay your fears of disrupting many websites. What do you say to that?
(Please do not hesitate to ask if you see or fear any weak point in my solution concept in Comment 16 modified by the consideration above.

Flags: needinfo?(dveditz)

I'm on the security team so I hope that will work. I can report on past attempts that failed because of breakage, but for whether a new approach would work on today's web I have to defer to the credentials team.

Flags: needinfo?(dveditz)

Daniel, you don't need to report examples of problems caused by well-intentioned improvements to Firefox. I know something like that enough. (And I suffered from it myself.) And the last thing I want is to cause something like that.

However I think that just as you as a member of the security team want that the functionality is preserved, the Credentials team will also care about security.

I also ask the Credentials team: Take a close look at my solution concept. If you have any doubts, please ask me! Please ask too for more details! I am sure that then in any case we will be able to find a final concept (or a compromise) together that will very likely be a good combination of preservation of functionality with acceptable security against insider attacks.

@daniel, FYI and to show that there is really a broad spectrum of insider attacks (but may be prevented all with only few, mostly simple methods not affecting the functionality).

I've found a additional (4th) method to reveal a saved password, which uses JavaScript. (It is a variant of (Aarons method 3)[https://bugzilla.mozilla.org/show_bug.cgi?id=2016257#c0], but this time not a bookmarklet is crafted for the attack but an <a> element in the login page of a web site. (Note: the URLs in the websites must not be restricted, they may use "javascript: ..." otherwise functionality may become broken. But the prevention is simply possible too in this case, by protection of the use of Developer Tools, see below.)

((The trick in this 4th attack vector is to circumvent a restriction of HTML attribute values. The string may be surrounded by single or double quotes and use inside the other type of quotes, but it is not possible to use inside the string both types of quotes. Therefore the selector 'input[type="password"]' cannot be used in the JS script. The circumvention is: marking the input[type='password'] by an class (.to-be-hacked). Then the selector 'input.to-be-hacked works. This trick was not necessary in Aarons "method 3" as the URL field of the bookmarklet needs not to be surrounded by quotes.))

The 4th method shows that restricting the bookmarklet (not to use "javascript: ..." URLs) is not enough. In the sequel simply the type attribute is changed from "password" to "text", but as it is JavaScript many other variants are possible: The value may e. g. be got from the input[type='password'] element and copied to any text element. So the prevention for this attack vector should be: If an primary password is set and a Developer Tools window should be opened, then require the primary password. Developer Tools allow to inject JS scripts anyway. (It seems that those injections cannot be prevented by a Content Security Policy. And I think that non-prevention is OK. The right point of protection is locking execution of Developer Tools until the owner of the Firefox profile allows it by entering the primary password or not-setting at all). And JS must be allowed to access password field values. (Any other that would indeed break many websites, especially those which have client-side encryption implemented. @Daniel: Have Firefox developers try to do such a restriction? If yes, then I understand your fears. But my solution concept does not touch the readability of input values by JS.)

How to do the hack:

  • Go to the orphaned PC of the victim (with Firefox started and primary password already entered)
  • In a new tab type the URL "about:logins"
  • Find an interesting entry (e. g. online banking)
  • Click "URL" (the login form will be displayed)
  • Right click "Inspect"
  • Add the attribute "class" or modify it by adding the class "to-be-hacked"
  • Now search any <a> element on the page. If there is none then add one (by "Edit HTML")
  • Right click on that <a> element, attribute "href" to edit the href.
  • Enter the following string as the new value of the href attribute (enclosed in double quotes):
javascript:(function(){document.querySelectorAll('input.to-be-hacked').forEach(function(el){el.type='text';});})();
  • Then change from the inspector (Web Developer) to the plain login form and click on the modified link (<a> field).
  • Result: The hidden password will be revealed.

Summary of this comment: Require the primary password to allow using the Developer Tools.

Flags: needinfo?(dveditz)
Flags: needinfo?(mtigley)
Flags: needinfo?(dveditz)

Please stop repeating known issues it does not add any value to the conversation.

Hi Simon,

I think that only one, who don't really have read and understood Comment 22, can think that I wanted to repeat an already reported issue. (FYI: It took me some hours to find a working attack vector 4. I assumed that something like that would work, but to find a provable method was not so simple.)

I'm interested in solutions. This bug is open since 9 months now and the problem exists since 3 years. I wanted to help: That all the possible attack vectors are understood and preventive methods (that do not disturb working websites) are found. I think the key to the solution is to look closely. (Not to lump everything together.) E. g. attack vector 3 may be prevented isolated, without touching URLs like "javascript: ..." inside of the DOM. E. g. attack vector 3 and attack vector 4 are similar but not the same and need different preventive methods.

But I fear that you are not really interested getting help: I have presented here a number of preventive methods and showed that they would not damage the functionality of websites. In sum that methods are a complete solution concept. My offer was in Comment 21.

But all I got was your Comment 22. No offense.

My offer (in Comment 21) is still standing (for a while).

Hi Martin,

I am sorry if there has been a misunderstanding I just think we are stretching the comments for this bug.

Yes, we should fix "reveal password" not requiring authentication. However, the priority is not high because it would still be trivial to extract the password using devtools as explained in comment 3. And even if devtools also required authentication, it would still be trivial to execute javascript in the page using bookmarklets. I am not entirely sure I understood your other attacks.

If you want to help by writing a patch to require authentication for "reveal password", for starters, I would be happy to help.

Hello Simon,

I am happy about your answer. Now we can move on to the factual questions.

But before we do that, let's clarify how I can help. I don't know Firefox's code at all. I also only looked at Rust superficially. But: I'm experienced in Ruby on Rails, web application security, user behavior, and especially password security (with all its aspects). And I'm quite old and I've solved a lot of technical problems that others thought were unsolvable. By breaking them down into solvable sub-problems.

While I can't write patches, I can break down the overall problem (insider attacks to reveal passwords) to be solved by a small number of simple countermeasures that you (or someone else who is familiar with the code of Firefox and its libraries). I have already done this in principle through earlier comments, but this has probably become confusing. I will therefore try to provide an overview here in the subsequent comment.

Problem analysis and solution concept

The overall problem

An internal attacker can take advantage of a user's temporary absence from the workplace to reveal and photograph stored passwords.

Complete list of attack vectors

(1) Context menu: "Reveal password". See description of this bug
(2) Edit "type" attribute by Web Developer Tools. See description of duplicate bug 2016257, "Method 2"
(3) Maliciously crafted URL in a bookmarklet. See description of duplicate bug 2016257, "Method 3"
(4) Maliciously crafted URL in an anchor tag. See comment 22
(5) Exploiting the disclosure of a password by the associated web service. See comment 13 item "(5)"

A 6th attack vector should be mentioned, although it does not lead to the disclosure of the password, however to misuse. (It is mentioned only here, because it can be prevented by the way during prevention of the 5 main vectors.):

(6) After a logged in session expires, the login form is filled out again so that the attacker can log in again. See comment 13 item "(4)"

Prevention methods

(1) Set a flag (or property) on a password field when if this is auto-filled by a saved password. This flag should be testable later by other prevention
methods. See comment 7. This flag is used by: prevention method 2, prevention method 5.
(2) Test the flag set by the prevention method 1 for the context menu. Disable "Reveal Password" if the flag is set. See comment 7. This method prevents: attack vector 1.
(3) A Web Developer Tool Window may be shown only if the user enters the Primary Password. This method prevents: attack vector 2, attack vector 4.
(4) Do not allow URLs in bookmarklets which start with "javascript:". This method prevents: attack vector 3.
(5) If via JavaScript an attribute of an auto-filled password field (see prevention method 1) should be changed from "password" to another value, then ask the user to enter the Primary Password (or the Quick Unlock value, see prevention method 6). If the user does not enter it correctly, then reset the value of the password field to an empty string (""). See comment 19. This method prevents: attack vector 5.
(6) Implement an optional QuickUnlock feature to keep things simple for the user. See comment 11. This method prevents also: attack vector 6. (It should not become difficult, however it is possible to make mistakes creating security flaws while implementing QuickUnlock. So I recommend to create an extra "bug" for this issue and to ask me for details.)

Final Notes

As you see: It is possible to target the vulnerabilities without affecting the rest of the functionality of websites.

I think this concept is also complete and prevents the overall problem if all the methods (or at least methods 1 to 5) are implemented. However it is not necessary to implement all the 6 prevention methods at once. I recommend to implement firstly methods 1 and 2 together and then the others step by step.

If I made a mistake or missed something, do not hesitate to ask. I hope the concept is clear enough. Otherwise it would make sense to move it to a document that may be edited and become versioned...

Blocks: 2075146
You need to log in before you can comment on or make changes to this bug.