Closed Bug 865948 (CVE-2013-1703) Opened 11 years ago Closed 11 years ago

nsScriptSecurityManager::CheckLoadURIWithPrincipal is broken for nsExpandedPrincipal

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23
Tracking Status
firefox20 --- wontfix
firefox21 + fixed
firefox22 + fixed
firefox23 + fixed
firefox-esr17 23+ fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- wontfix

People

(Reporter: bholley, Assigned: bholley)

References

Details

(Keywords: regression, sec-high, Whiteboard: [adv-main21+][adv-esr1708+])

Attachments

(3 files)

in CheckLoadURIWithPrincipal, we have special handling for nsExpandedPrincipal, in which we iterate over the whitelist, caling CheckLoadURIWithPrincipal on each one individually. But if none of those succeed, we return NS_OK (!!!) instead of a failure code. This means that the nsExpandedPrincipal can load whatever it wants. :-(

I really should have caught this in review. I'm currently investigating why this wasn't caught by our test coverage.
Probably better not to mark the dependency on bug 734891, which may be findable by inspection of the patch.
(In reply to Bobby Holley (:bholley) from comment #0)
> This means that
> the nsExpandedPrincipal can load whatever it wants. :-(

Trying to estimate the risk here... what can they load? For XHR this check is only used for the scheme check (we don't have test coverage for that :( ), but XHR to another domain that is not on the list still fails. For accessing object we don't rely on this check. Can we load anything else? Is anyone currently using nsEP based XHR?
(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #3)
> Can we load anything else? Is anyone currently using nsEP based XHR?

This check isn't just for XHR. In this particular case, it allows content to load about: (a system-principal paged) in an iframe, which should normally throw as insecure.
(In reply to Bobby Holley (:bholley) from comment #4)
> (In reply to Gabor Krizsanits [:krizsa :gabor] from comment #3)
> > Can we load anything else? Is anyone currently using nsEP based XHR?
> 
> This check isn't just for XHR. In this particular case, it allows content to
> load about: (a system-principal paged) in an iframe, which should normally
> throw as insecure.

Sure, I get that this check is used in other cases too. But I don't understand your example, how could content code ever run with nsEP to do that?
(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #5)
> Sure, I get that this check is used in other cases too. But I don't
> understand your example, how could content code ever run with nsEP to do
> that?

If they combine it with other vulnerabilities, like bug 865947. See bug 863933.
Thanks, I looked over that one. wow... just, wow...
Can we get a security rating here? Tracking regardless for now, but the sec rating will be important for uplift considerations.
Attachment #742718 - Flags: review?(gkrizsanits)
Attached patch Tests. v1 — — Splinter Review
Attachment #742719 - Flags: review?(gkrizsanits)
Flags: in-testsuite?
It's hard to say. I'm going to hazard a guess at sec-moderate on its own, but this is one of the pieces that make up bug 863933, which is sec-critical.
Keywords: sec-moderate
Attachment #742718 - Flags: review?(gkrizsanits) → review+
Comment on attachment 742719 [details] [diff] [review]
Tests. v1

Review of attachment 742719 [details] [diff] [review]:
-----------------------------------------------------------------

replace all 777777 -> 865948
Attachment #742719 - Flags: review?(gkrizsanits) → review+
Attached patch Tests. v2 r=gabor — — Splinter Review
Heh, sorry about the 777777 thing. I was on a plane and couldn't file a bug. :-)
Attachment #742757 - Flags: review+
Comment on attachment 742718 [details] [diff] [review]
Return the appropriate value when the whitelist checks fail. v1

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 734891 
User impact if declined: Potential security bugs, depending on who's using nsExpandedPrincipal. They only started being used outside of jetpack in FF21.
Testing completed (on m-c, etc.): Just pushed to inbound, but the patch is very safe.
Risk to taking this patch (and alternatives if risky): None. Not risky. 
String or IDL/UUID changes made by this patch: None
Attachment #742718 - Flags: approval-mozilla-esr17?
Attachment #742718 - Flags: approval-mozilla-beta?
Attachment #742718 - Flags: approval-mozilla-b2g18?
Attachment #742718 - Flags: approval-mozilla-aurora?
See comment 11 for the security ramifications of this beyond the immediate sec-moderate rating.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment on attachment 742718 [details] [diff] [review]
Return the appropriate value when the whitelist checks fail. v1

Given this is sec-mod,I am going to untrack it for Fx21 and let the fix land in Fx22.Also this is a regression from Fx16, hence no rush to get it landed in our final two beta's .Approving for aurora and a- for beta.

please renominate if there is a disagreement here.
Attachment #742718 - Flags: approval-mozilla-beta?
Attachment #742718 - Flags: approval-mozilla-beta-
Attachment #742718 - Flags: approval-mozilla-aurora?
Attachment #742718 - Flags: approval-mozilla-aurora+
Comment on attachment 742718 [details] [diff] [review]
Return the appropriate value when the whitelist checks fail. v1

(In reply to bhavana bajaj [:bajaj] from comment #18)
> Comment on attachment 742718 [details] [diff] [review]
> Return the appropriate value when the whitelist checks fail. v1
> 
> Given this is sec-mod

See comment 16. The security rating is kind of arbitrary here.

> Also this is a regression from Fx16, hence no rush to get it landed
> in our final two beta's.

It's a regression from Fx16 in that Fx16 introduced the feature of nsExpandedPrincipal. But we only started using it in the platform in Fx21.

I think we should take the patch. It's a one-liner that very clearly only takes effect in a situation that is, otherwise, a very obvious security bug.
Attachment #742718 - Flags: approval-mozilla-beta- → approval-mozilla-beta?
Comment on attachment 742718 [details] [diff] [review]
Return the appropriate value when the whitelist checks fail. v1

Reconsidered based on https://bugzilla.mozilla.org/show_bug.cgi?id=865948#c19 & because the patch is very safe . Approving on beta.

please land by tomorrow noon PT.
Attachment #742718 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment on attachment 742718 [details] [diff] [review]
Return the appropriate value when the whitelist checks fail. v1

This is out of scope for ESR17, being sec-moderate, approving for uplift to b2g18 though.
Attachment #742718 - Flags: approval-mozilla-esr17?
Attachment #742718 - Flags: approval-mozilla-esr17-
Attachment #742718 - Flags: approval-mozilla-b2g18?
Attachment #742718 - Flags: approval-mozilla-b2g18+
(In reply to lsblakk@mozilla.com from comment #22)
> Comment on attachment 742718 [details] [diff] [review]
> Return the appropriate value when the whitelist checks fail. v1
> 
> This is out of scope for ESR17, being sec-moderate, approving for uplift to
> b2g18 though.

Ok. We should definitely advisory-embargo this until esr17-EOL then. Al, is that the default behavior when we WONTFIX a sec bug on branch? This _could_ also imply embargoing bug 863933, which gets tricky...
Flags: needinfo?(abillings)
We only mention where we fix in advisories, not where we won't fix. 

This is only a sec-moderate. Normally, as an internal find, this would go into the rollup advisory under the list of "things found by Mozilla people that we fixed in 21" with a link to a list of bugs in bugzilla (and no details). This wouldn't get its own advisory.
Flags: needinfo?(abillings)
Whiteboard: [adv-main21+]
Al, this isn't actually an internal find, despite the fact that bholley filed the bug.  It is actually one part of bug 863933, which was externally reported, so it seems to me it thus qualifies as externally reported.

Personally, I think this is such a low risk fix, and part of a really awful exploit, so we should really just take it on ESR17.  Maybe we could even wait a few weeks, or maybe a month (when it will be in release), to get a better sense if there are any regressions.
Ah, I didn't realize that this was an external report. Let's loop in release management.
Blocks: 734891
Flags: sec-bounty+
(In reply to Andrew McCreight [:mccr8] from comment #26)
> Personally, I think this is such a low risk fix, and part of a really
> awful exploit, so we should really just take it on ESR17.  Maybe we
> could even wait a few weeks, or maybe a month (when it will be in
> release), to get a better sense if there are any regressions.

Re-nominating for ESR-17 based on the above.
Flags: needinfo?
Attachment #742718 - Flags: approval-mozilla-esr17- → approval-mozilla-esr17+
This seems safe, and given the security team's preference here, we've approved for the next ESR17 release.
Whiteboard: [adv-main21+] → [adv-main21+][adv-esr1708+]
Alias: CVE-2013-1703
Group: core-security
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: