Closed
Bug 511521
(CVE-2009-3376)
Opened 16 years ago
Closed 16 years ago
downloading file with RTL override (RLO) presents conflicting filenames
Categories
(Core Graveyard :: File Handling, defect, P1)
Core Graveyard
File Handling
Tracking
(status1.9.2 beta1-fixed, blocking1.9.1 .4+, status1.9.1 .4-fixed)
RESOLVED
FIXED
mozilla1.9.3a1
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta1-fixed |
blocking1.9.1 | --- | .4+ |
status1.9.1 | --- | .4-fixed |
People
(Reporter: geekboy, Assigned: ehsan.akhgari)
References
Details
(Keywords: verified1.8.1.24, verified1.9.0.15, verified1.9.1, Whiteboard: [sg:low])
Attachments
(6 files, 1 obsolete file)
57.06 KB,
image/png
|
Details | |
14 bytes,
application/octet-stream
|
Details | |
29.59 KB,
image/png
|
Details | |
132.34 KB,
image/png
|
Details | |
8.55 KB,
patch
|
bzbarsky
:
review+
smontagu
:
review+
benjamin
:
approval1.9.2+
dveditz
:
approval1.9.1.4+
dveditz
:
approval1.9.0.15+
dveditz
:
approval1.8.1.next+
|
Details | Diff | Splinter Review |
14 bytes,
application/zip
|
Details |
When downloading a file with the unicode RTL override character (RLO) in it ("S[RLO]iva.exe"), the file download dialog presents two different filenames: one in the title ("Sexe.avi") and one in the content of the dialog ("Savi.exe"). The RLO character is stripped for the Save dialog later presented.
This is inconsistent use of the RLO unicode character U+202E. Perhaps it should just be removed from any downloaded filename.
Reporter | ||
Comment 1•16 years ago
|
||
This is a text file with a filename containing RLO. It should display as Siva.exe when RLO is stripped out or ignored, and Sexe.avi when RLO is honored.
Reporter | ||
Comment 2•16 years ago
|
||
Comment 3•16 years ago
|
||
We should strip RLO (at least) from downloaded files, since Windows Explorer and Mac Finder both make it look like you have a .avi file (if you look at the extension rather than the "type").
Reporter | ||
Comment 4•16 years ago
|
||
This patch strips out \u202E in the default file name in the file chooser dialog and in the display string/title string in the init dialog displayed when the download link is clicked.
Updated•16 years ago
|
Whiteboard: [sg:moderate]
Reporter | ||
Comment 5•16 years ago
|
||
Comment 6•16 years ago
|
||
CCing some bidi people who might have ideas about how common RLO is in real filenames, and whether there are any other characters we should strip from download filenames.
Comment 7•16 years ago
|
||
A generic solution would be removing all LRE, RLE, LRO, RLO, and PDF, as any of the first four characters may have bad effects (confusing looks or security issues) if the relevant PDF is missing. These characters are disallowed in IDNA (also IDNAbis) as well.
(In reply to comment #4)
> Created an attachment (id=395622) [details]
> proposed patch
It's better to remove these from suggestedFileName, to prevent further problems with names like: "[RLO].txt".
Assignee | ||
Comment 8•16 years ago
|
||
(In reply to comment #6)
> CCing some bidi people who might have ideas about how common RLO is in real
> filenames, and whether there are any other characters we should strip from
> download filenames.
RLO and the rest of these control characters are not at all common in real file names, so I second Behnam's suggestion of removing them altogether.
I have a patch which handles this in the helper app service, with a unit test.
Assignee: nobody → ehsan.akhgari
Status: NEW → ASSIGNED
Assignee | ||
Comment 9•16 years ago
|
||
Attachment #395622 -
Attachment is obsolete: true
Attachment #395825 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•16 years ago
|
Component: General → File Handling
Product: Firefox → Core
QA Contact: general → file-handling
Version: 3.5 Branch → Trunk
Comment 10•16 years ago
|
||
Jumping in with Jesse's suggestion. I wanted to add some other perspective if I could.
If you were to strip RLO from filenames, you'd clearly be risking data-loss, and may even open the software up to other attacks – e.g. attackers could now bypass other content filters, anti-virus etc. with files like: nasty[RLO].[RLO]e[RLO]x[RLO]e. Although from your diff it looks like you're proposing to replace the RLO with the _ character.
Another idea would be to change the UI display in cases where the end user must make a security decision, such as a file download dialog box.
If you do go with the removing/replacing change, then you should also at theRLM and LRM to your list of unsafeBidiCharacters:
U+200E LEFT-TO-RIGHT MARK
U+200F RIGHT-TO-LEFT MARK
Assignee | ||
Comment 11•16 years ago
|
||
(In reply to comment #10)
> Jumping in with Jesse's suggestion. I wanted to add some other perspective if
> I could.
>
> If you were to strip RLO from filenames, you'd clearly be risking data-loss,
> and may even open the software up to other attacks – e.g. attackers could now
> bypass other content filters, anti-virus etc. with files like:
> nasty[RLO].[RLO]e[RLO]x[RLO]e. Although from your diff it looks like you're
> proposing to replace the RLO with the _ character.
Yes, indeed removing those characters would be a mistake - we always replace invalid characters with '_' (and so does this patch).
> Another idea would be to change the UI display in cases where the end user must
> make a security decision, such as a file download dialog box.
>
> If you do go with the removing/replacing change, then you should also at theRLM
> and LRM to your list of unsafeBidiCharacters:
>
> U+200E LEFT-TO-RIGHT MARK
> U+200F RIGHT-TO-LEFT MARK
Hmm, why? RLM and LRM don't change the representation of strong LTR/RTL characters (for example, latin alphabets), do they? Do you have any example in which these characters can be used for spoofing?
![]() |
||
Updated•16 years ago
|
Attachment #395825 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 12•16 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
status1.9.1:
--- → ?
Flags: wanted1.9.0.x?
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
Assignee | ||
Updated•16 years ago
|
Flags: wanted1.9.2?
Assignee | ||
Updated•16 years ago
|
Attachment #395825 -
Flags: approval1.9.2?
Attachment #395825 -
Flags: approval1.9.1.3?
Attachment #395825 -
Flags: approval1.9.0.14?
Comment 13•16 years ago
|
||
Comment on attachment 395825 [details] [diff] [review]
Patch (v1)
Pushing out approval requests to releases that aren't currently frozen.
Attachment #395825 -
Flags: approval1.9.1.4?
Attachment #395825 -
Flags: approval1.9.1.3?
Attachment #395825 -
Flags: approval1.9.0.15?
Attachment #395825 -
Flags: approval1.9.0.14?
Updated•16 years ago
|
blocking1.9.1: --- → ?
Flags: wanted1.9.0.x?
Flags: wanted1.9.0.x+
Flags: blocking1.9.0.15?
Comment 14•16 years ago
|
||
(In reply to comment #11)
I thought I had a test case for the LRM and RLM that produced files looking like "Sexe." but I can't find those cases and couldn't reproduce. You're right these wouldn't change strong LTR/RTL characters but the case of symbols and punctionation I thought was different.
Updated•15 years ago
|
blocking1.9.1: ? → .4+
Flags: blocking1.9.0.15? → blocking1.9.0.15+
Comment 15•15 years ago
|
||
Comment on attachment 395825 [details] [diff] [review]
Patch (v1)
Requesting additional review from smontagu for a sanity-check on this security change. (new super-review guidelines seem to call for sr= on all security bug fixes; I can count bz as the sr=).
Do all (web-sourced) files we write to disk go through this path? (e.g. what if there's no file picker but the user auto-saves the file)
Attachment #395825 -
Flags: review?(smontagu)
Comment 16•15 years ago
|
||
I think it would probably be more solid to add the Bidi control characters to the macros at the end of xpcom/ds/nsCRT.h, as in the fix for bug 393488 (attachment 313060 [details] [diff] [review]).
Assignee | ||
Comment 17•15 years ago
|
||
That's the approach I tried first, but FILE_ILLEGAL_CHARACTERS is a narrow character string, and some of its consumers use it on narrow strings. I'm not sure how to add Unicode characters without breaking compatibility with existing callers.
Assignee | ||
Comment 18•15 years ago
|
||
Assignee | ||
Updated•15 years ago
|
Attachment #397522 -
Attachment filename: Siva.bin → Siva.bin
Attachment #397522 -
Attachment mime type: application/octet-stream → video/mpeg
Assignee | ||
Updated•15 years ago
|
Attachment #397522 -
Attachment mime type: video/mpeg → application/zip
Assignee | ||
Updated•15 years ago
|
Attachment #397522 -
Attachment filename: Siva.bin → Siva.bin
Assignee | ||
Comment 19•15 years ago
|
||
(In reply to comment #15)
> Do all (web-sourced) files we write to disk go through this path? (e.g. what if
> there's no file picker but the user auto-saves the file)
Yes, they all do. Please see attachment 397522 [details] as an example (you need to configure your browser to always save zip files to disk without prompting.)
Assignee | ||
Comment 20•15 years ago
|
||
Comment on attachment 395825 [details] [diff] [review]
Patch (v1)
Clearing the approval requests based on the assigned blocking flags.
Attachment #395825 -
Flags: approval1.9.1.4?
Attachment #395825 -
Flags: approval1.9.0.15?
Assignee | ||
Comment 21•15 years ago
|
||
This should block 1.9.2 as well I think.
Flags: wanted1.9.2? → blocking1.9.2?
Comment 22•15 years ago
|
||
(In reply to comment #20)
> (From update of attachment 395825 [details] [diff] [review])
> Clearing the approval requests based on the assigned blocking flags.
Ehsan: Patches on the stable branches (1.9.1 and 1.9.0) require explicit approval before landing.
Assignee | ||
Comment 23•15 years ago
|
||
Comment on attachment 395825 [details] [diff] [review]
Patch (v1)
(In reply to comment #22)
> (In reply to comment #20)
> > (From update of attachment 395825 [details] [diff] [review] [details])
> > Clearing the approval requests based on the assigned blocking flags.
>
> Ehsan: Patches on the stable branches (1.9.1 and 1.9.0) require explicit
> approval before landing.
Oh, sorry about that. Restoring the flags...
Attachment #395825 -
Flags: approval1.9.1.4?
Attachment #395825 -
Flags: approval1.9.0.15?
Comment 24•15 years ago
|
||
smontagu: are you satisfied with the answer in comment 17?
Whiteboard: [sg:moderate] → [sg:moderate][needs r=smontagu]
Comment 25•15 years ago
|
||
Attachment #395825 -
Flags: review?(smontagu) → review+
Updated•15 years ago
|
Whiteboard: [sg:moderate][needs r=smontagu] → [sg:moderate]
Updated•15 years ago
|
Attachment #395825 -
Flags: approval1.9.1.4?
Attachment #395825 -
Flags: approval1.9.1.4+
Attachment #395825 -
Flags: approval1.9.0.15?
Attachment #395825 -
Flags: approval1.9.0.15+
Comment 26•15 years ago
|
||
Comment on attachment 395825 [details] [diff] [review]
Patch (v1)
Approved for 1.9.1.4 and 1.9.0.15, a=dveditz for release-drivers
Assignee | ||
Comment 27•15 years ago
|
||
Landed on 1.9.1:
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/ac59325cf0a9
Assignee | ||
Comment 28•15 years ago
|
||
Landed on 1.9:
Checking in uriloader/exthandler//nsExternalHelperAppService.cpp;
/cvsroot/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp,v <-- nsExternalHelperAppService.cpp
new revision: 1.371; previous revision: 1.370
done
Checking in uriloader/exthandler//tests/mochitest/Makefile.in;
/cvsroot/mozilla/uriloader/exthandler/tests/mochitest/Makefile.in,v <-- Makefile.in
new revision: 1.2; previous revision: 1.1
done
RCS file: /cvsroot/mozilla/uriloader/exthandler/tests/mochitest/test_unsafeBidiChars.xhtml,v
done
Checking in uriloader/exthandler//tests/mochitest/test_unsafeBidiChars.xhtml;
/cvsroot/mozilla/uriloader/exthandler/tests/mochitest/test_unsafeBidiChars.xhtml,v <-- test_unsafeBidiChars.xhtml
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/uriloader/exthandler/tests/mochitest/unsafeBidiFileName.sjs,v
done
Checking in uriloader/exthandler//tests/mochitest/unsafeBidiFileName.sjs;
/cvsroot/mozilla/uriloader/exthandler/tests/mochitest/unsafeBidiFileName.sjs,v <-- unsafeBidiFileName.sjs
initial revision: 1.1
done
Keywords: fixed1.9.0.15
Updated•15 years ago
|
Flags: blocking1.9.2? → blocking1.9.2+
Priority: -- → P1
Updated•15 years ago
|
Attachment #395825 -
Flags: approval1.9.2? → approval1.9.2+
Assignee | ||
Comment 29•15 years ago
|
||
status1.9.2:
--- → beta1-fixed
Comment 30•15 years ago
|
||
Verified for 1.9.0.15 with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15pre) Gecko/2009091606 GranParadiso/3.0.15pre (.NET CLR 3.5.30729).
Keywords: fixed1.9.0.15 → verified1.9.0.15
Comment 31•15 years ago
|
||
Verified for 1.9.1.4 with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.4pre) Gecko/20090921 Shiretoko/3.5.4pre and Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4pre) Gecko/20090921 Shiretoko/3.5.4pre (.NET CLR 3.5.30729).
Keywords: verified1.9.1
Comment 32•15 years ago
|
||
The filename is shown with the actual .exe extension in enough places that this is more of a "low" than a moderate.
Whiteboard: [sg:moderate] → [sg:low]
Updated•15 years ago
|
Alias: CVE-2009-3376
Updated•15 years ago
|
Flags: wanted1.8.1.x+
Flags: blocking1.8.1.next?
Assignee | ||
Updated•15 years ago
|
Attachment #395825 -
Flags: approval1.8.1.next?
Updated•15 years ago
|
Flags: blocking1.8.1.next? → blocking1.8.1.next+
Comment 33•15 years ago
|
||
Comment on attachment 395825 [details] [diff] [review]
Patch (v1)
Approved for 1.8.1.24, a=dveditz for release-drivers
If the test harness on the 1.8 branch doesn't handle these tests please just check in the patch.
Attachment #395825 -
Flags: approval1.8.1.next? → approval1.8.1.next+
Comment 34•15 years ago
|
||
Landed on 1.8.1:
Checking in uriloader/exthandler/nsExternalHelperAppService.cpp;
/cvsroot/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp,v <-- nsExternalHelperAppService.cpp
new revision: 1.290.4.21; previous revision: 1.290.4.20
done
Assignee | ||
Comment 35•15 years ago
|
||
Patch landed on 1.8.1.24 by dwitte:
<http://bonsai.mozilla.org/cvsview2.cgi?diff_mode=context&whitespace_mode=show&subdir=mozilla/uriloader/exthandler&command=DIFF_FRAMESET&file=nsExternalHelperAppService.cpp&rev1=1.290.4.20&rev2=1.290.4.21&root=/cvsroot>
I did not include the tests, because the 1.8 branch does not provide the required infrastructure.
Keywords: fixed1.8.1.24
Comment 36•15 years ago
|
||
Interesting. I tried this in the Seamonkley 1.1 nightly (Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.24pre) Gecko/20100225 SeaMonkey/1.1.19pre). The naming issue seems to be fixed but Seamonkey 1.1 hangs as it does the download after you tell it where to save the file. I don't know if this is an unrelated issue.
Assignee | ||
Comment 37•15 years ago
|
||
(In reply to comment #36)
> Interesting. I tried this in the Seamonkley 1.1 nightly (Mozilla/5.0
> (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.24pre) Gecko/20100225
> SeaMonkey/1.1.19pre). The naming issue seems to be fixed but Seamonkey 1.1
> hangs as it does the download after you tell it where to save the file. I don't
> know if this is an unrelated issue.
Could you please attach a debugger and get a stack for the hang?
Comment 38•15 years ago
|
||
This isn't a debug build, it is the Seamonkey nightly. I have no idea as to how to get you a stack on OS X.
Assignee | ||
Comment 39•15 years ago
|
||
(In reply to comment #38)
> This isn't a debug build, it is the Seamonkey nightly. I have no idea as to how
> to get you a stack on OS X.
If the build does not come with symbols, then you probably need a debug build.
Comment 40•15 years ago
|
||
I don't QA Seamonkey and I am not set up to build 1.8.1 in any case so I don't have access to a debug build of it. I only used it to test because it was a 1.8.1 based build that had an easy browser built in.
Once we have our blocking Thunderbird issue (not this) fixed, I will check this bug in a TB build and hopefully verify it. If you wish to dig into the Seamoney side, perhaps Kairo can be of some help.
![]() |
||
Comment 41•15 years ago
|
||
Anyone wanting to look into that further probably needs to do his own build, we don't build debug or symbols on my private machines that do SeaMonkey 1.x builds.
Also, we will announce the 1.8.1.24-based SeaMonkey 1.1.19 as EOL release that contains known flaws but should at least be better than 1.1.18 for those who can't switch to the 2.0.x series. In that light, I'm not sure how much time one wants to spend on that.
We'll see what Al's Thunderbird testing results in.
Comment 42•15 years ago
|
||
The fix works on TB. I verified this in Thunderbird 2.0.0.24pre using Thunderbrowse on OS X: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.24pre) Gecko/2010022613 Thunderbird/2.0.0.24pre ThunderBrowse/3.2.8.1.
Keywords: fixed1.8.1.24 → verified1.8.1.24
Updated•9 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•