Closed Bug 851987 Opened 11 years ago Closed 11 years ago

Crash [@ nsGlobalWindow::GetChildWindow] with event.view, lookupMethod

Categories

(Core :: DOM: Events, defect)

x86_64
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla22
Tracking Status
firefox20 --- unaffected
firefox21 + fixed
firefox22 + fixed
firefox-esr17 --- unaffected
b2g18 --- unaffected

People

(Reporter: jruderman, Assigned: bholley)

References

Details

(4 keywords)

Attachments

(3 files)

The crash is reliable under ASan.  It's less reliable in a normal debug build.

While the testcase reminds me of bug 809674, I think this is regression from within the last few days.
Attached file stack (ASan)
Yes, this is a regression from bug 850517.
Assignee: nobody → bobbyholley+bmo
Depends on: 850517
Blocks: 850517
No longer depends on: 850517
Blocks: 823228
So, the issue here is that nsIDOMWindow can actually be implemented by XPCWrappedJS in various situations. So a static cast from nsIDOMWindow to nsGlobalWindow isn't safe. I'm pretty sure nsPIDOMWindow is safe, but I'd appreciate if someone could confirm that.

bz did something similar in bug 823228, so aurora is affected as well.
Comment on attachment 726006 [details] [diff] [review]
QI to nsPIDOMWindow instead of nsIDOMWindow in XPCWrappedJS. v1

Oh, yikes.  Good catch.

r=me
Attachment #726006 - Flags: review?(bzbarsky) → review+
Keywords: sec-critical
Comment on attachment 726006 [details] [diff] [review]
QI to nsPIDOMWindow instead of nsIDOMWindow in XPCWrappedJS. v1

[Security approval request comment]
How easily could an exploit be constructed based on the patch?

Not super easily. The issue here is a mis-cast, which means that the attacker would need to do some fancy heap exploit stuff to make this work.

Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?

Nope.

Which older supported branches are affected by this flaw?

Aurora.

If not all supported branches, which bug introduced the flaw?

bug 823228 and bug 850517.

Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?

Easy backport. The aurora backport should just be one of the two chunks of this patch.

How likely is this patch to cause regressions; how much testing does it need?

Not risky.
Attachment #726006 - Flags: sec-approval?
Comment on attachment 726006 [details] [diff] [review]
QI to nsPIDOMWindow instead of nsIDOMWindow in XPCWrappedJS. v1

Please create an Aurora patch as well and nominate it for inclusion there. 

Sec-approval+
Attachment #726006 - Flags: sec-approval? → sec-approval+
Comment on attachment 726006 [details] [diff] [review]
QI to nsPIDOMWindow instead of nsIDOMWindow in XPCWrappedJS. v1

Requesting aurora approval for this patch. Note that this patch has two hunks, one of which will apply on aurora and one of which won't. That's to be expected, we just want to push the hunk in XPCWrappedNativeXrayTraits::resolveOwnProperty.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 823228
User impact if declined: security
Testing completed (on m-c, etc.): Going into inbound now.
Risk to taking this patch (and alternatives if risky): Not risky.
String or UUID changes made by this patch: None.
Attachment #726006 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/632ec7d6a9ae
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Comment on attachment 726006 [details] [diff] [review]
QI to nsPIDOMWindow instead of nsIDOMWindow in XPCWrappedJS. v1

low risk fix for a sec-crit regression .Approving for uplift .

[Please keep https://bugzilla.mozilla.org/show_bug.cgi?id=851987#c8 in mind when landing this on aurora ]
Attachment #726006 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Group: core-security
This testcase uses |Components|, so I don't think it's worth checking in at this point.
Flags: in-testsuite? → in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: