Last Comment Bug 793121 - (CVE-2012-4195) nsLocation::CheckURL can use the wrong principal
(CVE-2012-4195)
: nsLocation::CheckURL can use the wrong principal
Status: RESOLVED FIXED
fix in bug 801305
: csectype-priv-escalation, csectype-sop, regression, sec-high
Product: Core
Classification: Components
Component: Security (show other bugs)
: unspecified
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Bobby Holley (:bholley) (busy with Stylo)
:
Mentors:
Depends on: 801305
Blocks: 754202
  Show dependency treegraph
 
Reported: 2012-09-21 03:23 PDT by moz_bug_r_a4
Modified: 2013-01-10 21:34 PST (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
unaffected
+
fixed
+
fixed
+
verified
+
verified
unaffected


Attachments

Description moz_bug_r_a4 2012-09-21 03:23:16 PDT
This is a regression from bug 754202. (fx16,17,18 are affected.)

When a chrome code calls an untrusted function via CrossCompartmentWrapper/WaiveXrayWrapper, GetSubjectPrincipal returns a content principal, but GetPrincipalAndFrame returns the system principal.  nsLocation::CheckURL gets an owner principal by calling GetCxSubjectPrincipalAndFrame, which calls GetPrincipalAndFrame.  

By using this bug, content can perform an XSS attack, and if there is an extension that exposes a chrome window to content, content can run arbitrary code with chrome privileges.
Comment 1 moz_bug_r_a4 2012-09-21 03:25:18 PDT
Created attachment 663341 [details]
testcase 1 - XSS

This tries to get cookies for www.mozilla.org.
Comment 2 moz_bug_r_a4 2012-09-21 03:26:43 PDT
Created attachment 663342 [details]
testcase 2 - arbitrary code execution with Error Console
Comment 3 Bobby Holley (:bholley) (busy with Stylo) 2012-10-02 16:28:44 PDT
I decided to do this work over in public over in bug 797204, since the security issue at hand is non-obvious.
Comment 4 Lukas Blakk [:lsblakk] use ?needinfo 2012-10-03 10:44:08 PDT
We've already gone to build with beta6 so the window on 16 landings has closed. Wontfixing for 16.
Comment 6 Daniel Veditz [:dveditz] 2012-10-15 16:40:18 PDT
Re-noming for 16 in case we consider this fix for a 16.0.2 "location cleanup" chemspill. In light of bug 801305 though it might be incomplete and/or regression prone; Firefox 17 might be as early as we want to push it.
Comment 7 Lukas Blakk [:lsblakk] use ?needinfo 2012-10-16 16:42:48 PDT
bug 797204 has the uplift approvals, just need them to land on branches.
Comment 8 Bobby Holley (:bholley) (busy with Stylo) 2012-10-17 01:38:00 PDT
(In reply to Lukas Blakk [:lsblakk] from comment #7)
> bug 797204 has the uplift approvals, just need them to land on branches.

Unfortunately we determined that bug 797204 doesn't fix this bug. I've got more targeted patches over in bug 801305.
Comment 9 Alex Keybl [:akeybl] 2012-10-23 15:11:36 PDT
(In reply to Bobby Holley (:bholley) from comment #8)
> (In reply to Lukas Blakk [:lsblakk] from comment #7)
> > bug 797204 has the uplift approvals, just need them to land on branches.
> 
> Unfortunately we determined that bug 797204 doesn't fix this bug. I've got
> more targeted patches over in bug 801305.

Can we mark FF17-19 as fixed now that bug 801305 has landed?
Comment 10 Daniel Veditz [:dveditz] 2012-10-25 11:41:10 PDT
Created attachment 675226 [details]
Testcase 1 -- XSS (updated)

The original XSS testcase doesn't work because www.mozilla.org now has an X-Frame-Options header to prevent framing. This is functionally equivalent, at least until blog.mozilla.org does the same thing.
Comment 11 Daniel Veditz [:dveditz] 2012-10-25 12:38:03 PDT
I'm downgrading to sec-high because it's not at the moment a known drive-by exploit. addons are already on dangerous ground using unwrapped DOM objects and should not be injecting content that way.
Comment 12 Daniel Veditz [:dveditz] 2012-10-25 12:56:48 PDT
bug 801305 hadn't been checked in on branches when comment 9 was asked, but it has now and I've verified the fix in Nightly and Aurora.

Note You need to log in before you can comment on or make changes to this bug.