From Matt Brubeck: Mozilla Firefox Test Case: Form Auto-completion Privacy Leak Introduction This test case demonstrates a way that a malicious web page can obtain data from a user's form-fill history. This attack requires the victim to scroll through the form auto-complete menu using the keyboard. Test Case Instructions 1. First, enter a value into the "Add data" field in Form 1. Press the submit button. Enter and submit several more values, all beginning with the same character (for example: "101", "184", "190"). 2. Type same first character into the "Test" field in Form 2. The form auto-complete menu will appear, populated with the values entered in the previous step. 3. Press the "down arrow" key to scroll through the auto-complete menu. As you scroll, the values you scroll past will be added to the field labeled "Leak", and all of them will be submitted if you submit the form. (A malicious web page would make the "Leak" field invisible, or send the captured data some other way.) Comments A malicious web page could target a common field name (like "SSN"), or a field name from a particular web site. Tricks could be used to make it more likely for victims to scroll through the history: For example, the malicious page could ask the user to submit a form twice with the same value, which would would appear in the formfill history the second time. The requested value could be chosen to appear below likely values for sensitive data. This bug could be fixed by disabling all event handlers and timer functions while the form-fill menu is open. Alternately, the "value" attribute of an input field should not be updated while the user is scrolling through the form-fill menu. Test case tested and found to work on: * Mozilla Firefox nightly build 20041107 (branch, Windows installer) Not yet tested on: * Mozilla Seamonkey * Other Firefox builds or platforms * Other clients [dveditz note: Seamonkey is not vulnerable, it fills forms in toto only on request and does not have an active auto-complete feature]
In e-mail discussion Mike Shaver notes: > If I skip [step 2] (don't type a letter, just press Down), the attack > fails, likely because the value isn't put into the text field until it's > selected. That sounds like we could fix the problem pretty easily by > just not pre-filling the field in the complete case, until the entry is > selected. For comparison: IE's autocomplete does not move values into the field until the user hits enter to select it. Sounds like this would be the consensus behavior to fix this privacy problem.
we should try and fix this as per comment 2.
... which is probably pretty easy, since it's the behavior that we already use when there are no characters typed.
Actually, that's not true on the trunk anymore, and I'm not sure why. But either changing nsAutoCompleteController::CompleteValue or changing when it's called is probably the solution.
Created attachment 173766 [details] [diff] [review] Don't pre-fill when the user scrolls through the list with keys Looks like we just need to not change the field value for up/down key events. I've tested this and it does indeed fix the problem.
12 years ago
Comment on attachment 173766 [details] [diff] [review] Don't pre-fill when the user scrolls through the list with keys firstname.lastname@example.org
Comment on attachment 173766 [details] [diff] [review] Don't pre-fill when the user scrolls through the list with keys sr=jst, but it might be worth adding a comment there to indicate to developers that adding this code back is not a goode idea.
12 years ago
Oh, fwiw, I added this comment: // Note: Do not fill in the text area here. That happens when // the user selects it. This holds parity with IE and fixes // bug 270697.
Arg, now I remember this bug. I wrote a patch right before the holidays and promptly forgot about it. If you just strip out the code you reference then autocomplete for various UI bits (e.g. URL bar, search bar) doesn't work the way people want it to work.
Created attachment 173794 [details] [diff] [review] preserve URLbar behavior
Comment on attachment 173766 [details] [diff] [review] Don't pre-fill when the user scrolls through the list with keys I think we need to preserve the old urlbar behavior
Comment on attachment 173794 [details] [diff] [review] preserve URLbar behavior >Index: browser/base/content/browser.xul > <textbox id="urlbar" flex="1" > type="autocomplete" > autocompletesearch="history" > autocompletepopup="PopupAutoComplete" >+ completeSelectedIndex="true" <snip> >Index: toolkit/content/widgets/autocomplete.xml >+ <property name="completeSelectedIndex" >+ onset="this.setAttribute('completeselectedindex', val); return val;" >+ onget="return this.getAttribute('completeselectedindex') == 'true';"/> >+ This won't actually work will it? Since the attribute specified in the browser XUL is camel case and the getters/setters are using lowercase. Anyway, I'd prefer it get prefixed with 'auto'. i.e. 'autocompleteselectedindex' or 'autocompleteselection' perhaps? (i slightly favor the latter, but your call).
Created attachment 173914 [details] [diff] [review] preserve URLbar behavior v2 You're right about the case, this patch fixes it. The attribute name matches the existing completeDefaultIndex so I'll stick with it unless a toolkit guy wants to rename both.
Comment on attachment 173914 [details] [diff] [review] preserve URLbar behavior v2 I don't like the name of completedefaultindex either, since it doesn't match the 'auto' prefix, but fair enough. >+ // if the completeSelectedIndex attribute is set Nit: Not entirely true. It can be set to false, and the code won't get run.... >+ PRBool completeSelection; >+ mInput->GetCompleteSelectedIndex(&completeSelection); >+ if (completeSelection) r=caillon
Comment on attachment 173914 [details] [diff] [review] preserve URLbar behavior v2 r=mconnor
fix checked into aviary 1.0.1 branch
Fixed on trunk
tested on mac 10.3.8 using 2005021806-1.0.1 firefox bits. when going thru the attached test case, I saw the following appear in the Leak textfield as I used the down arrow to scroll through the items in the Test fields autocomplete menu: ::1:1:1 is this correct or buggy behavior?
(In reply to comment #19) That is correct (non-buggy) behavior.
excellent! (btw, also see the same result using the same build on Windows XP.) marking verified.
This fix did not cause, but may have greatly exacerbated, crash bug 280084