Closed Bug 1371853 Opened 7 years ago Closed 7 years ago

Possible native rooting issue in XPCConvert::JSObject2NativeInterface()

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox-esr52 55+ fixed
firefox54 --- wontfix
firefox55 + fixed
firefox56 + fixed

People

(Reporter: mccr8, Assigned: bzbarsky)

References

Details

(Keywords: csectype-uaf, sec-critical, Whiteboard: [adv-main55-][adv-esr52.3-][post-critsmash-triage])

Attachments

(1 file)

This method contains a call to CheckedUnwrap:
  JSObject* inner = js::CheckedUnwrap(src, /* stopAtWindowProxy = */ false);
then an XPCWN is gotten off of inner, an nsISupports is gotten from that XPCWN, then we call QI on it. If the QI is implemented in JS (is that possible?) and src != inner, then the XPCWN or the nsISupports might get destroyed. |inner| should probably at least be rooted, if not the XPCWN and |iface|.
There's similar issues with the CheckedUnwrap call in XPCConvert::JSValToXPCException().
See Also: → CVE-2017-7801
> If the QI is implemented in JS (is that possible?)

Yes, if it's a double-wrapped XPCWrappedJS.
Just for posterity, the failure mode is if entering JS causes us to turn src into a DeadObjectWrapper, thereby effectively leaving "inner" not rooted and possibly killing the XPCWN hanging off it.
Attachment #8877718 - Flags: review?(continuation)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8877718 [details] [diff] [review]
Root the unwrapped object in XPCConvert code

[Security approval request comment]
How easily could an exploit be constructed based on the patch?  Not very.  For one thing, the set of objects that pages can access that are actually XPCWrappedNative is pretty limited.  But also, it's not immediately clear how "unwrapped" could fail to be rooted.

Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?  Not any more so than the actual change.

Which older supported branches are affected by this flaw?  All of them.

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

Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?  This should be pretty easy and safe to backport.

How likely is this patch to cause regressions; how much testing does it need?  Not likely and not much.
Attachment #8877718 - Flags: sec-approval?
Attachment #8877718 - Flags: review?(continuation) → review+
OK, moving this patch to bug 1371259.
Depends on: CVE-2017-7801
Attachment #8877718 - Flags: sec-approval?
Fixed by bug 1371259.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Group: dom-core-security → core-security-release
Target Milestone: --- → mozilla56
Minusing this for advisories since Nils' bug will get advisory credit.
Whiteboard: [adv-main55-][adv-esr52.3-]
Flags: qe-verify-
Whiteboard: [adv-main55-][adv-esr52.3-] → [adv-main55-][adv-esr52.3-][post-critsmash-triage]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: