Bug 481342 (CVE-2009-1307)

Adobe Flash loaded from view-source: protocol - network security policy bypass and localhost LSO reading/writing

VERIFIED FIXED

Status

()

Core
Security
VERIFIED FIXED
9 years ago
2 years ago

People

(Reporter: Gregory Fleischer, Assigned: dcamp)

Tracking

({verified1.8.1.22, verified1.9.0.9, verified1.9.1})

unspecified
verified1.8.1.22, verified1.9.0.9, verified1.9.1
Points:
---
Bug Flags:
blocking1.9.1 +
blocking1.9.0.9 +
wanted1.9.0.x +
blocking1.8.1.next +
wanted1.8.1.x +
blocking1.8.0.next +
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sg:high], URL)

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20

The following was sent to Adobe PSIRT (psirt@adobe.com):

*Overview*

When a Flash file is loaded in Mozilla Firefox from within the
'view-source:' protocol handler, the Adobe Flash plugin miscalculates
the origin of the content. To the plugin, it appears the content was
loaded from the local file system.

This introduces two specific security weaknesses:

    * bypass of 'crossdomain.xml' and access to arbitrary third-party
      web content

    * ability to read and write local shared objects within the
      context of localhost

*Background*

In Mozilla Firefox, it isn't normally possible to render content using
the 'view-source:' pseudo protocol handler. However, by providing the
content as a valid JAR file, the 'jar:' handler can be used to load a
file as HTML from within the context of 'view-source:'. 

This sequence would appear as:
    
    jar:view-source:http://example.com/data.jar!/page.html

where 'data.jar' would contain:

    * page.html
    * content.swf

The 'page.html' file would include 'content.swf' within an embed tag and
the Flash content would be loaded with a root path of
'view-source:http://example.com/data.jar!/content.swf'.

*Summary*

The Flash security policy restricts objects from accessing third-party
web content unless the third-party site opts in via a
'crossdomain.xml' file. For content that is loaded from the local file
system, no network access is allowed unless a user specifically allows
it by adding a security exception. But, by default, local Flash
objects can load any other local file system content.

Because Flash believes that any content loaded from 'view-source:'
originated on the local machine, the Flash standard network security
policy is not applied. The standard 'crossdomain.xml' file is not
consulted. Mozilla Firefox allows access to the third-party data
because both sets of content originate on the network.

When a Flash object is loaded from within the 'view-source:' protocol,
the content is created within the context of the 'localhost'
hostname. This allows for the creation of Local Shared Object (LSO)
that appears to originate from the localhost.

Since the local networking restrictions can be circumvented by
resubmitting the content using a 'view-source:' URL, coordinating
third-party sites can read and write locally shared objects as well as
post the information back. In this way, a complete privacy compromise
and user tracking is possible.

*Details*

Additional details and demonstrations are available at 
http://pseudo-flaw.net/v/view-source-flash-issues/


Reproducible: Always
I think this is just a hole in the fix for bug 369814.  We should, imo be checking that not only is the HTTP header set that way but that GetContentType on |channel| (NOT on the nsIHttpChannel) gives the same type.  Since view-source: overides the type, there wouldn't be a problem, right?
Status: UNCONFIRMED → NEW
Component: Security → Security
Ever confirmed: true
Product: Firefox → Core
QA Contact: firefox → toolkit
Flags: blocking1.9.1?
Flags: blocking1.9.0.8?

Comment 2

9 years ago
What data does the view-source channel actually give back? Is it just the parent channel's data?

The linked website is public. Has this vulnerability been publicly announced?
> Is it just the parent channel's data?

Yes, with a special content-type that causes special processing in nsContentDLF.

I should note that on our end view-source URIs are properly created as nested URIs and so forth, so we give them the right principals and whatnot.
(Reporter)

Comment 4

9 years ago
(In reply to comment #2)
 
> The linked website is public. Has this vulnerability been publicly announced?

No, this vulnerability hasn't been publicly announced.  The information was sent to Adobe PSIRT and entered here.
Blocking 1.9.0.8 probably isn't reasonable without a 1.9.1 fix (1.9.0.9 is more realistic), but blocking for now since I can't make it block 1.9.1
Flags: wanted1.9.0.x+
Flags: blocking1.9.0.8?
Flags: blocking1.9.0.8+
Whiteboard: [sg:high]
ccing some likely fixers.  I guess I could patch this, but then I'm not sure who to get to review it...
(Assignee)

Comment 7

9 years ago
(In reply to comment #1)
> I think this is just a hole in the fix for bug 369814.  We should, imo be
> checking that not only is the HTTP header set that way but that GetContentType
> on |channel| (NOT on the nsIHttpChannel) gives the same type.  Since
> view-source: overides the type, there wouldn't be a problem, right?

If we generally avoid rendering view-source content, and jar: lets someone get around that, should we just always disallow unpacking if our child is a view-source channel?

Just extending the 369814 fix will still leave people vulnerable if they have the network.jar.open-unsafe-types pref set.

Also, if flash is generally treating unknown protocols as local, this might happen again if another channel implements nsIHttpChannel and doesn't happen to override GetContentType().  Maybe we should really only trust nsHttpChannel to provide the safe-jar content type?
> should we just always disallow unpacking if our child is a view-source channel?

We could, yes.

> still leave people vulnerable if they have the network.jar.open-unsafe-types
> pref set.

They're already vulnerable to various attacks, but agreed.

> Also, if flash is generally treating unknown protocols as local,

Then it's busted in all sorts of ways and should be fixed, imo...  Any extension protocol will break that assumption, no?
(Assignee)

Comment 9

9 years ago
Created attachment 366006 [details] [diff] [review]
v1
Assignee: nobody → dcamp
Attachment #366006 - Flags: superreview?(bzbarsky)
Attachment #366006 - Flags: review?(bzbarsky)
Attachment #366006 - Flags: superreview?(bzbarsky)
Attachment #366006 - Flags: superreview+
Attachment #366006 - Flags: review?(bzbarsky)
Attachment #366006 - Flags: review+
Comment on attachment 366006 [details] [diff] [review]
v1

Looks good.  Tests, please?
(Assignee)

Comment 11

9 years ago
Created attachment 366027 [details] [diff] [review]
v1 with tests

Not sure why that patch didn't include the test changes...
Attachment #366006 - Attachment is obsolete: true
(Assignee)

Comment 12

9 years ago
This patch conflicts a bit with the patch in bug 474536.  If that patch is going to land on 1.9.0/1.9.1 we should land it first, otherwise I can put together a new patch for those branches.

Updated

9 years ago
Flags: blocking1.9.1? → blocking1.9.1+

Updated

9 years ago
Keywords: checkin-needed
(Assignee)

Comment 13

9 years ago
http://hg.mozilla.org/mozilla-central/rev/38ce0b3beaec
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
(Assignee)

Updated

9 years ago
Flags: in-testsuite? → in-testsuite+
Keywords: checkin-needed
(Assignee)

Comment 14

9 years ago
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/20470e9fc806
Keywords: fixed1.9.1
(Assignee)

Updated

9 years ago
Attachment #366027 - Flags: approval1.9.0.8?
Comment on attachment 366027 [details] [diff] [review]
v1 with tests

Approved for 1.9.0.8, a=dveditz for release-drivers
Attachment #366027 - Flags: approval1.9.0.8? → approval1.9.0.8+
(Assignee)

Comment 16

9 years ago
Checking in docshell/test/Makefile.in;
/cvsroot/mozilla/docshell/test/Makefile.in,v  <--  Makefile.in
new revision: 1.14; previous revision: 1.13
done
Checking in docshell/test/test_bug369814.html;
/cvsroot/mozilla/docshell/test/test_bug369814.html,v  <--  test_bug369814.html
new revision: 1.2; previous revision: 1.1
done
Checking in modules/libjar/nsJARChannel.cpp;
/cvsroot/mozilla/modules/libjar/nsJARChannel.cpp,v  <--  nsJARChannel.cpp
new revision: 1.131; previous revision: 1.130
done
Checking in bug369814.jar;
/cvsroot/mozilla/docshell/test/bug369814.jar,v  <--  bug369814.jar
initial revision: 1.1
done
Keywords: fixed1.9.0.8
Verified for 1.9.0.8 using the checked in tests, which pass.
Keywords: fixed1.9.0.8 → verified1.9.0.8
1.9.0.8 was renamed to 1.9.0.9, to make room for an inserted "Firefox 3.0.8". The release containing this fix has been renamed to "Firefox 3.0.9" but will release on pretty much the same schedule (mid-April).
Flags: wanted1.8.1.x+
Flags: blocking1.8.1.next+

Comment 19

9 years ago
Created attachment 371669 [details] [diff] [review]
1.8.0 branch patch

Comment 20

9 years ago
Comment on attachment 371669 [details] [diff] [review]
1.8.0 branch patch

Can you check this one?
Attachment #371669 - Flags: review?(bzbarsky)
Comment on attachment 371669 [details] [diff] [review]
1.8.0 branch patch

Looks fine.
Attachment #371669 - Flags: review?(bzbarsky) → review+

Updated

8 years ago
Attachment #371669 - Flags: approval1.8.0.next+

Comment 22

8 years ago
Comment on attachment 371669 [details] [diff] [review]
1.8.0 branch patch

a=asac for 1.8.0

Updated

8 years ago
Flags: blocking1.8.0.next+

Comment 23

8 years ago
Created attachment 374884 [details] [diff] [review]
same for 1.8
Attachment #374884 - Flags: approval1.8.1.next?
Comment on attachment 374884 [details] [diff] [review]
same for 1.8

Approved for 1.8.1.22, a=dveditz for release-drivers
Attachment #374884 - Flags: approval1.8.1.next? → approval1.8.1.next+
Checked into the 1.8(.1) branch
Checking in Makefile.in;
/cvsroot/mozilla/modules/libjar/Makefile.in,v  <--  Makefile.in
new revision: 1.50.2.1; previous revision: 1.50
done
Checking in nsJARChannel.cpp;
/cvsroot/mozilla/modules/libjar/nsJARChannel.cpp,v  <--  nsJARChannel.cpp
new revision: 1.116.2.5; previous revision: 1.116.2.4
done
Keywords: fixed1.8.1.22
Verified for 1.8.1 using http://pseudo-flaw.net/v/view-source-flash-issues/thirdpartycontent.html and Seamonkey 1.8 nightly (Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.22pre) Gecko/20090602 SeaMonkey/1.1.17pre).

Verified for 1.9.1 with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1pre) Gecko/20090601 Shiretoko/3.5pre. 

Verified for trunk with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090529 Minefield/3.6a1pre.
Status: RESOLVED → VERIFIED
Keywords: fixed1.8.1.22, fixed1.9.1 → verified1.8.1.22, verified1.9.1
Alias: CVE-2009-1307
Group: core-security
You need to log in before you can comment on or make changes to this bug.