Bug 270697 (autocompleteLeak)

Autocomplete data leak

VERIFIED FIXED

Status

()

Firefox
Location Bar
VERIFIED FIXED
13 years ago
10 years ago

People

(Reporter: dveditz, Assigned: dveditz)

Tracking

(Depends on: 2 bugs, {fixed-aviary1.0.1, privacy})

1.0 Branch
fixed-aviary1.0.1, privacy
Points:
---
Dependency tree / graph
Bug Flags:
blocking-aviary1.0.1 +
blocking-aviary1.5 +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sg:fix] have fix need SR ben, approval)

Attachments

(2 attachments, 2 obsolete attachments)

(Assignee)

Description

13 years ago
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]
(Assignee)

Comment 1

13 years ago
Created attachment 166384 [details]
testcase
(Assignee)

Comment 2

13 years ago
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.
Whiteboard: [sg:fix]
(Assignee)

Updated

13 years ago
Alias: autocompleteLeak
(Assignee)

Updated

13 years ago
Blocks: 278184
(Assignee)

Updated

12 years ago
Flags: blocking-aviary1.0.1?
we should try and fix this as per comment 2.
Flags: blocking-aviary1.1+
Flags: blocking-aviary1.0.1?
Flags: blocking-aviary1.0.1+

Updated

12 years ago
Assignee: bugs → caillon
... 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.
Attachment #173766 - Flags: superreview?(jst)
Attachment #173766 - Flags: review?(mconnor)
Comment on attachment 173766 [details] [diff] [review]
Don't pre-fill when the user scrolls through the list with keys

r=mconnor@steelgryphon.com
Attachment #173766 - Flags: review?(mconnor) → review+
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.
Attachment #173766 - Flags: superreview?(jst) → superreview+
Attachment #173766 - Flags: approval-l10n?
Attachment #173766 - Flags: approval-aviary1.0.1?
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.
(Assignee)

Comment 10

12 years ago
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.
(Assignee)

Comment 11

12 years ago
Created attachment 173794 [details] [diff] [review]
preserve URLbar behavior
Attachment #173766 - Attachment is obsolete: true
Attachment #173794 - Flags: superreview?(caillon)
Attachment #173794 - Flags: review?(mconnor)
(Assignee)

Comment 12

12 years ago
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
Attachment #173766 - Flags: approval-l10n?
Attachment #173766 - Flags: approval-aviary1.0.1?
Attachment #173766 - Flags: approval-aviary1.0.1-
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).
Attachment #173794 - Flags: superreview?(caillon) → superreview-
(Assignee)

Comment 14

12 years ago
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.
Assignee: caillon → dveditz
Attachment #173794 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #173914 - Flags: superreview?(caillon)
Attachment #173914 - Flags: review?(mconnor)
Attachment #173914 - Flags: approval-aviary1.0.1?
(Assignee)

Updated

12 years ago
Attachment #173794 - Flags: review?(mconnor)
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
Attachment #173914 - Flags: review?(mconnor) → review+
(Assignee)

Updated

12 years ago
Attachment #173914 - Flags: superreview?(caillon) → superreview?(bugs)

Updated

12 years ago
Whiteboard: [sg:fix] → [sg:fix] have fix need SR ben
(Assignee)

Updated

12 years ago
Whiteboard: [sg:fix] have fix need SR ben → [sg:fix] have fix need SR ben, approval
Attachment #173914 - Flags: approval-aviary1.0.1? → approval-aviary1.0.1+
(Assignee)

Comment 17

12 years ago
fix checked into aviary 1.0.1 branch
Keywords: fixed-aviary1.0.1
(Assignee)

Comment 18

12 years ago
Fixed on trunk
Status: ASSIGNED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
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.
Status: RESOLVED → VERIFIED
(Assignee)

Comment 22

12 years ago
This fix did not cause, but may have greatly exacerbated, crash bug 280084
(Assignee)

Updated

12 years ago
Group: security
(Assignee)

Updated

12 years ago
Attachment #173914 - Flags: superreview?(bugs)

Updated

12 years ago
Depends on: 286933
(Assignee)

Updated

10 years ago
Depends on: 381681
You need to log in before you can comment on or make changes to this bug.