Closed Bug 829310 Opened 11 years ago Closed 11 years ago

compartment mismatch in nsWindowSH::NewResolve for dialogArguments with Xrays

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox18 --- wontfix
firefox19 --- wontfix
firefox20 - wontfix
firefox21 - wontfix
firefox22 - wontfix
firefox23 - wontfix
firefox-esr17 --- wontfix
b2g18 --- wontfix
b2g18-v1.0.1 --- wontfix

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

(Keywords: sec-audit)

Found by inspection in bug 826471: "The chunk of code in nsWindowSH::NewResolve for sDialogArguments_id also looks sketchy to me. It grabs the argument object off of the window, then uses the window's context to set a property on obj, which in this Xray case is not in the same compartment as the window, I believe. nsJSContext::SetProperty does an XPCAutoRequest, but doesn't enter a compartment anywhere as far as I can see."

I've tried writing a testcase, but I haven't managed to yet.  dialogArguments is apparently only present with showModalDialog.
I don't know how exploitable this actually is.  It is pretty old code.
Can web content affect the dialog arguments, or is this only a problem for privileged code?
I think it can choose what it is, but this only is a problem when Xrays are involved, and maybe those are only from privileged code?  I haven't seen any crashes with this in the wild, so maybe it is not common for addons to touch this.
(In reply to Andrew McCreight [:mccr8] from comment #3)
> I think it can choose what it is, but this only is a problem when Xrays are
> involved, and maybe those are only from privileged code?

Unprivileged scopes get Xrays to non-same-origin content, and can also create xrays via Components.lookupMethod.
Batch edit: Bugs marked status-b2g18: affected after 2/13 branching of v1.0.1 are now also status-b2g18-v1.0.1: affected
(In reply to Andrew McCreight [:mccr8] from comment #1)
> I don't know how exploitable this actually is.  It is pretty old code.

Why track this for release if the sec-critical rating is only theoretical right now? We should consider completing an investigation and finding a testcase prior to tracking.
Depends on: 860941
It isn't clear that there's actually a problem here, and bholley is rewriting this, so I'm just going to downgrade it.
Keywords: sec-criticalsec-audit
Bobby, do you think this is okay to close now?  I don't know if this is part of the code that you rewrote or not.
Yeah, it all goes through IDL now.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Group: core-security → core-security-release
Group: core-security-release
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.