Closed Bug 950173 Opened 12 years ago Closed 10 years ago

moz-icon:file:// may be accessed over HTTP, leading to directory / drive enumeration with interaction

Categories

(Core :: Graphics: ImageLib, defect)

26 Branch
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mozilla, Unassigned)

Details

(Keywords: sec-moderate)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 Steps to reproduce: 1) Create a page containing <img src="moz-icon:file:///" /> 2) Serve the page over HTTP 3) View the page in Firefox Actual results: On Windows: Explorer's icon for C: is displayed On Linux: The theme's folder icon is displayed In most themes the icon for existing directories is distinct from the icon for unknown files, so an attacker can test for a directory's existence via user interaction. Additionally, on Windows the <img>'s error event will trigger when referencing a non-existent drive (e.g. "moz-icon:file:///L:/" ) without user interaction, giving an attacker a list of valid drives as well as whether a drive was connected while the user was on the page. Paths to files do not generally leak existence info, as if the file does not exist, the file extension is used to choose the icon. file: URLs with UNC paths seem to be similarly unaffected as they don't display any icon at all. Expected results: The broken file icon should be displayed, consistent with <img>s referencing the file scheme when served over HTTP.
Add a PoC that demonstrates abuse of <img src="moz-icon:file://DRIVELETTER/" onerror="notConnected()" /> on Windows
Sets highly stretched icons as the background of squares, so only the color of the centermost pixel is visible. Then asks users to click squares that have the same color as directories under the guise of a CAPTCHA. Depends on the "unknown filetype" and "folder" icons having distinct colors in the center pixel, but it works with the Tango icon set as well as Windows 7. Partially inspired by http://lcamtuf.blogspot.com/2013/05/some-harmless-old-fashioned-fun-with-css.html .
OS: Windows 7 → All
Hardware: x86_64 → All
Can we just kill off untrusted access to moz-icon altogether? Or make moz-icon:file:// use a different scheme with different permission bits?
Status: UNCONFIRMED → NEW
Component: Security → ImageLib
Ever confirmed: true
(In reply to Boris Zbarsky [:bz] from comment #3) > Can we just kill off untrusted access to moz-icon altogether? +1.
I mean, we'd need to replace it with something else for file:// and especially ftp:// directory listing rendering. But other than that, there are no valid uses I know of.
Flags: needinfo?(dveditz)
Flags: needinfo?(dveditz)
Group: core-security → gfx-core-security
Looks like this stopped reproing in FF 43. Not sure what changed between 42 and 43, but it should be fine to mark as resolved if the vector hasn't just changed.
OK, let's reopen if there are indications it's still around.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
Group: gfx-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: