JSON.parse with reviver allows redefining non-configurable properties
Originally disclosed on Mozilla
- Fixed in 6 months
- Paid in 7 months
- Disclosed after 6 months
Created attachment 8530046
Testcase: look at your web console
Credit for this one also to André Bargull.
The implementation of Walk() in json.cpp (used when there is a reviver) uses JSObject::defineGeneric to define the property. This is not what the spec says to do, and in particular it's missing the various sanity checks that [[DefineOwnProperty]] is supposed to perform. Compare to what Object.defineProperty does (which lands in DefinePropertyOnObject, which does those checks).
Anyway, the upshot is that you can redefine non-configurable properties. André's testcase does this with Location, redefining things like toString.
This particular testcase is "fixed" by my patch in bug 1101123, in that before you get to toString you try to redefine "href", which is an accessor property so you get an exception. Except per spec failures to define a prop during Walk shouldn't throw afaict, and I'm sure the testcase could be adjusted to avoid the href issue.... and in any case, this can be used to redefine non-configurable stuff on objects which only have value props no matter what I do in bug 1101123.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A high-severity security bug in JavaScript Engine. Mozilla made it public on 20 May 2015 as CVE-2015-4478.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.