Closed
Bug 1218437
Opened 9 years ago
Closed 8 years ago
Firefox crash by checking x instanceof Components.Exception when x is not an object
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
People
(Reporter: tabmix.onemen, Assigned: bzbarsky)
References
Details
(Keywords: crash, regression, sec-other, Whiteboard: [adv-main53-][adv-esr52.1-])
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
qdot
:
review+
jcristau
:
approval-mozilla-aurora+
jcristau
:
approval-mozilla-beta+
jcristau
:
approval-mozilla-esr52+
|
Details | Diff | Splinter Review |
Firefox crash by checking x instanceof Components.Exception when x is not an object
Comment 1•8 years ago
|
||
This is crashing somewhere in JS land. Odd. Jan, any idea what's up here?
Sample crashreports:
53: https://crash-stats.mozilla.com/report/index/cb0e4ce9-1b8b-4792-abf3-f59d52170325
55: https://crash-stats.mozilla.com/report/index/70eb054a-6f02-4643-a2ed-748672170325
(latter looks like it has a more useful stack)
STR:
1. eval in browser toolbox: null instanceof Components.Exception
status-firefox53:
--- → affected
Component: General → JavaScript Engine
Flags: needinfo?(jdemooij)
Product: Firefox → Core
Comment 2•8 years ago
|
||
We end up in nsXPCComponents_Exception::HasInstance. There we pass v.toObjectOrNull() to UNWRAP_OBJECT:
http://searchfox.org/mozilla-central/rev/7419b368156a6efa24777b21b0e5706be89a9c2f/js/xpconnect/src/XPCComponents.cpp#1713
Then in UnwrapObject we call GetDOMClass and assume |obj| is nullptr.
http://searchfox.org/mozilla-central/rev/7419b368156a6efa24777b21b0e5706be89a9c2f/dom/bindings/BindingUtils.h#203
Hiding this as I really don't like that unchecked toObjectOrNull() call.
Group: core-security
Component: JavaScript Engine → XPConnect
Flags: needinfo?(jdemooij)
Comment 3•8 years ago
|
||
bz, any thoughts on this? Is this code available to content?
Flags: needinfo?(bzbarsky)
Comment 4•8 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #2)
> Then in UnwrapObject we call GetDOMClass and assume |obj| is nullptr.
I meant non-nullptr, obviously.
Comment 5•8 years ago
|
||
Components.Exception is not available to content, I think, so I'm not sure this is reachable from public web code, which might affect security-severity?
Assignee | ||
Comment 6•8 years ago
|
||
This should not be available to content, no.
This is a clear bug that was introduced in <https://hg.mozilla.org/mozilla-central/rev/16cf9da0d24282153c9ea53e49439dcb3aac194f>: The UNWRAP_OBJECT things should only happen if isObject().
Flags: needinfo?(bzbarsky)
Assignee | ||
Comment 7•8 years ago
|
||
MozReview-Commit-ID: 8lwCoilRz49
Attachment #8851622 -
Flags: review?(kyle)
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment 8•8 years ago
|
||
I'll mark this sec-other because it isn't clear this is really a problem, but we'd like to leave it hidden in case it is.
Keywords: sec-other
Updated•8 years ago
|
Blocks: 911258
status-firefox-esr45:
--- → affected
status-firefox-esr52:
--- → affected
Keywords: crash,
regression
Comment 9•8 years ago
|
||
(In reply to Boris Zbarsky [:bz] (still a bit busy) (if a patch has no decent message, automatic r-) from comment #7)
> Created attachment 8851622 [details] [diff] [review]
I assume the CanvasRenderingContext2D.cpp fontMetrics stuff in the patch is part of some other fix?
Flags: needinfo?(bzbarsky)
Assignee | ||
Updated•8 years ago
|
Attachment #8851622 -
Attachment is obsolete: true
Attachment #8851622 -
Flags: review?(kyle)
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(bzbarsky)
Updated•8 years ago
|
Attachment #8851697 -
Flags: review?(kyle) → review+
Assignee | ||
Comment 11•8 years ago
|
||
Assignee | ||
Comment 12•8 years ago
|
||
Comment on attachment 8851697 [details] [diff] [review]
Need to check that the value is an object before we try to UNWRAP_OBJECT it to check whether it's an Exception
[Approval Request Comment]
If this is not a sec:{high,crit} bug, please state case for ESR consideration:
Simple crash fix for a possibly-exploitable crash, if it can be triggered.
User impact if declined: Crashes if extensions do the wrong thing.
Fix Landed on Version: 55
Risk to taking this patch (and alternatives if risky): Very low risk.
String or UUID changes made by this patch: None.
See https://wiki.mozilla.org/Release_Management/ESR_Landing_Process for more info.
Approval Request Comment
[Feature/Bug causing the regression]: Bug 911258
[User impact if declined]: Possibly-exploitable crash, if it can be triggered.
[Is this code covered by automated tests?]: No
[Has the fix been verified in Nightly?]: Yes, on my local machine.
[Needs manual test from QE? If yes, steps to reproduce]: See comment 1
[List of other uplifts needed for the feature/fix]: None.
[Is the change risky?]: No.
[Why is the change risky/not risky?]: Just adds a missing type of value check.
[String changes made/needed]: None.
Attachment #8851697 -
Flags: approval-mozilla-esr52?
Attachment #8851697 -
Flags: approval-mozilla-esr45?
Attachment #8851697 -
Flags: approval-mozilla-beta?
Attachment #8851697 -
Flags: approval-mozilla-aurora?
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Comment 14•8 years ago
|
||
Comment on attachment 8851697 [details] [diff] [review]
Need to check that the value is an object before we try to UNWRAP_OBJECT it to check whether it's an Exception
crash fix for aurora and beta
Attachment #8851697 -
Flags: approval-mozilla-beta?
Attachment #8851697 -
Flags: approval-mozilla-beta+
Attachment #8851697 -
Flags: approval-mozilla-aurora?
Attachment #8851697 -
Flags: approval-mozilla-aurora+
Comment 15•8 years ago
|
||
uplift |
https://hg.mozilla.org/releases/mozilla-aurora/rev/3e5bbabd5279
https://hg.mozilla.org/releases/mozilla-beta/rev/4409827e9906
status-firefox44:
affected → ---
status-firefox52:
--- → wontfix
status-firefox54:
--- → fixed
tracking-firefox53:
--- → ?
tracking-firefox54:
--- → ?
tracking-firefox55:
--- → ?
tracking-firefox-esr45:
--- → ?
tracking-firefox-esr52:
--- → ?
Updated•8 years ago
|
Group: core-security → core-security-release
Updated•8 years ago
|
Comment 16•8 years ago
|
||
Flagging this for manual testing, str available in Comment 1.
Flags: qe-verify+
Comment 17•8 years ago
|
||
Comment on attachment 8851697 [details] [diff] [review]
Need to check that the value is an object before we try to UNWRAP_OBJECT it to check whether it's an Exception
let's take this in esr52 as well now
Attachment #8851697 -
Flags: approval-mozilla-esr52? → approval-mozilla-esr52+
Updated•8 years ago
|
Comment 18•8 years ago
|
||
uplift |
Updated•8 years ago
|
Whiteboard: [adv-main53-][adv-esr52.1-]
Comment 19•8 years ago
|
||
Reproduced the initial crash using 53 beta 5, verified that the crash no longer happens using Firefox 53 beta 9, latest Developer Edition 54.0a2 and latest Nightly 55.0a1 on macOS 10.12.4, Windows 10 64bit and Ubuntu 16.04 32bit.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Comment 20•8 years ago
|
||
Bogdan, could you please take a look at this on 52.1esr as well?
Flags: needinfo?(bogdan.maris)
Comment 21•8 years ago
|
||
(In reply to Andrei Vaida, QA [:avaida] – please ni? me from comment #20)
> Bogdan, could you please take a look at this on 52.1esr as well?
I can also confirm that Fx 52.1.0esr-build3 does not crash across platforms (macOS 10.12.4, Windows 10 64bit and Ubuntu 16.04 32bit).
Flags: needinfo?(bogdan.maris)
Comment 22•7 years ago
|
||
Comment on attachment 8851697 [details] [diff] [review]
Need to check that the value is an object before we try to UNWRAP_OBJECT it to check whether it's an Exception
esr45 is gone.
Attachment #8851697 -
Flags: approval-mozilla-esr45?
Updated•7 years ago
|
Updated•7 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•