Closed
Bug 1317936
(CVE-2016-9904)
Opened 8 years ago
Closed 8 years ago
Fix cross-origin information leak from shared atoms
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
People
(Reporter: jandem, Assigned: jandem)
References
Details
(Keywords: csectype-sop, sec-high, Whiteboard: [adv-main50.1+][adv-ESR45.6+] Disclosure date ~Jan 21 2017 (note Fx51 scheduled for Jan 24))
Attachments
(2 files)
31.24 KB,
patch
|
jorendorff
:
review+
jonco
:
review+
gchang
:
approval-mozilla-aurora+
gchang
:
approval-mozilla-beta+
ritu
:
approval-mozilla-release+
gchang
:
approval-mozilla-esr45+
dveditz
:
sec-approval+
|
Details | Diff | Splinter Review |
5.12 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
JS code can use a Map/Set timing attack to determine whether an atom is used by another compartment/zone. See bug 1312001.
The plan (bug 1312001 comment 13) is to add a hash code to atoms, to avoid leaking information about the atom's address.
Assignee | ||
Comment 1•8 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #0)
> The plan (bug 1312001 comment 13)
Er, bug 1312001 comment 18.
Assignee | ||
Updated•8 years ago
|
Summary: Fix cross-origin information leak exposed by shared atoms → Fix cross-origin information leak from shared atoms
Assignee | ||
Comment 2•8 years ago
|
||
Unfortunately this will add 8 bytes to all atoms, due to GC alignment restrictions. In theory we could use the 4 unused bytes as extra inline storage, but that will complicate things tremendously. Another option is to store the hash code only for atoms with length > X and calculate it lazily for short strings. Maybe we can do that as a follow-up.
Assignee | ||
Comment 3•8 years ago
|
||
This adds a hash to all atoms and uses it in HashableValue::hash().
I think we have to fix jsid hashing to use this hash as well, since ShapeTables likely have a similar issue :/
Attachment #8811253 -
Flags: review?(jorendorff)
Attachment #8811253 -
Flags: review?(jcoppeard)
Comment 4•8 years ago
|
||
Comment on attachment 8811253 [details] [diff] [review]
Part 1 - Add hash code to atoms and use it for Map/Set
Review of attachment 8811253 [details] [diff] [review]:
-----------------------------------------------------------------
This is a nice clean patch.
Not for this bug, but now that we have separate thing kinds for atoms would it be possible to get rid of the ATOM_BIT flag and the process of morphing strings into atoms?
Attachment #8811253 -
Flags: review?(jcoppeard) → review+
Assignee | ||
Comment 5•8 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #4)
> Not for this bug, but now that we have separate thing kinds for atoms would
> it be possible to get rid of the ATOM_BIT flag and the process of morphing
> strings into atoms?
Nice idea. I think it would hurt perf though as isAtom() is queried on some very hot paths (including JIT code we generate for comparing strings).
Comment 6•8 years ago
|
||
Comment on attachment 8811253 [details] [diff] [review]
Part 1 - Add hash code to atoms and use it for Map/Set
Review of attachment 8811253 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/builtin/MapObject.cpp
@@ +69,4 @@
> {
> // HashableValue::setValue normalizes values so that the SameValue relation
> // on HashableValues is the same as the == relationship on
> // value.data.asBits.
Comment needs to be updated.
Attachment #8811253 -
Flags: review?(jorendorff) → review+
Updated•8 years ago
|
Keywords: csectype-sop,
sec-high
Assignee | ||
Comment 7•8 years ago
|
||
This changes jsid hashing to use atom->hash() if the id is an atom, to prevent a similar attack on shape tables.
I had to move DefaultHasher<jsid> to an internal header, a bit unfortunate but there are no consumers outside SpiderMonkey atm. The alternative is to move HashId out of line but I'd like to avoid the perf overhead of that for now.
When this is on all branches I'll post another patch to add comments.
Attachment #8812732 -
Flags: review?(jcoppeard)
Assignee | ||
Updated•8 years ago
|
Attachment #8811253 -
Attachment description: Patch → Part 1 - Add hash code to atoms and use it for Map/Set
Comment 8•8 years ago
|
||
Comment on attachment 8812732 [details] [diff] [review]
Part 2 - Fix jsid hashing
Review of attachment 8812732 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good.
::: js/src/jsiter.cpp
@@ -75,5 @@
> - }
> - static bool match(jsid id1, jsid id2) {
> - return id1 == id2;
> - }
> -};
Thanks for removing this.
Attachment #8812732 -
Flags: review?(jcoppeard) → review+
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(dveditz)
Comment 10•8 years ago
|
||
[Tracking Requested - why for this release]: sec-high with disclosure date around the release date of Fx51.
status-firefox50:
--- → affected
status-firefox51:
--- → affected
status-firefox52:
--- → affected
status-firefox53:
--- → affected
tracking-firefox51:
--- → ?
tracking-firefox52:
--- → ?
tracking-firefox53:
--- → ?
Whiteboard: Disclosure date ~Jan 21 2017 (note Fx51 scheduled for Jan 24)
Assignee | ||
Comment 12•8 years ago
|
||
Comment on attachment 8811253 [details] [diff] [review]
Part 1 - Add hash code to atoms and use it for Map/Set
Requesting approval for both patches.
[Security approval request comment]
> How easily could an exploit be constructed based on the patch?
Not trivial. Maybe with some work.
> Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
No.
> Which older supported branches are affected by this flaw?
All.
> Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Should be possible to backport this. There is some risk but this has to be in 51.
> How likely is this patch to cause regressions; how much testing does it need?
Perf and correctness regressions are certainly possible, but having this code in a few Nightlies before uplifting should be sufficient I think.
Attachment #8811253 -
Flags: sec-approval?
Updated•8 years ago
|
Attachment #8811253 -
Flags: sec-approval? → sec-approval+
Assignee | ||
Comment 14•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(jdemooij)
Assignee | ||
Comment 15•8 years ago
|
||
This was merged a few days ago:
https://hg.mozilla.org/mozilla-central/rev/be48744b160459666cbf97f065a97cdad695092f
https://hg.mozilla.org/mozilla-central/rev/b92dcbb89ffcf96216a9cfdacfc3b2d652606028
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Assignee | ||
Comment 16•8 years ago
|
||
Comment on attachment 8811253 [details] [diff] [review]
Part 1 - Add hash code to atoms and use it for Map/Set
Approval Request Comment
[Feature/regressing bug #]: Old bug.
[User impact if declined]: Security issues.
[Describe test coverage new/current, TreeHerder]: This code is exercised by pretty much all tests we have.
[Risks and why]: These patches are not trivial so there is some risk. But still, this code is exercised a lot and Nightly testing didn't reveal any issues so far AFAIK.
[String/UUID change made/needed]: None.
Attachment #8811253 -
Flags: approval-mozilla-esr45?
Attachment #8811253 -
Flags: approval-mozilla-beta?
Attachment #8811253 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 17•8 years ago
|
||
These approval requests apply to both patches.
Comment 18•8 years ago
|
||
Comment on attachment 8811253 [details] [diff] [review]
Part 1 - Add hash code to atoms and use it for Map/Set
Fix a sec-high. Beta51+, Aurora52+, and ESR45+. Should be in 51 beta 4.
Attachment #8811253 -
Flags: approval-mozilla-esr45?
Attachment #8811253 -
Flags: approval-mozilla-esr45+
Attachment #8811253 -
Flags: approval-mozilla-beta?
Attachment #8811253 -
Flags: approval-mozilla-beta+
Attachment #8811253 -
Flags: approval-mozilla-aurora?
Attachment #8811253 -
Flags: approval-mozilla-aurora+
Comment 19•8 years ago
|
||
Comment 21•8 years ago
|
||
Updated•8 years ago
|
Group: javascript-core-security → core-security-release
Comment 22•8 years ago
|
||
jan, this has problems to apply to esr45
grafting 377427:c82318b2897c "Bug 1317936 part 1 - Add hash code to atoms. r=jonco,jorendorff a=gchang"
merging js/src/builtin/MapObject.cpp
merging js/src/gc/Allocator.cpp
merging js/src/gc/Heap.h
merging js/src/jit/VMFunctions.cpp
merging js/src/jsatom.cpp
merging js/src/jsatominlines.h
merging js/src/jscompartment.cpp
merging js/src/jscompartment.h
merging js/src/jsgc.cpp
merging js/src/jsgc.h
merging js/src/vm/Runtime.cpp
merging js/src/vm/String-inl.h
merging js/src/vm/String.cpp
merging js/src/vm/String.h
warning: conflicts while merging js/src/gc/Allocator.cpp! (edit, then use 'hg resolve --mark')
warning: conflicts while merging js/src/gc/Heap.h! (edit, then use 'hg resolve --mark')
warning: conflicts while merging js/src/jscompartment.h! (edit, then use 'hg resolve --mark')
warning: conflicts while merging js/src/jsgc.cpp! (edit, then use 'hg resolve --mark')
warning: conflicts while merging js/src/vm/String.cpp! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
Assignee | ||
Comment 23•8 years ago
|
||
https://hg.mozilla.org/releases/mozilla-esr45/rev/edd9158508d92d1d99229fa6079b90d1b0e16293
https://hg.mozilla.org/releases/mozilla-esr45/rev/222bdae65a115b06057fd1029f3fd38e26bfaecd
status-firefox-esr45:
--- → fixed
Comment 24•8 years ago
|
||
Temporarily reverted from esr45 for reasons. No action needed on your part, this'll be relanded at the appropriate time.
https://hg.mozilla.org/releases/mozilla-esr45/rev/29961c35f618
https://hg.mozilla.org/releases/mozilla-esr45/rev/45f5aa933cfa
Updated•8 years ago
|
tracking-firefox50:
--- → ?
tracking-firefox-esr45:
--- → ?
Comment 25•8 years ago
|
||
Comment on attachment 8811253 [details] [diff] [review]
Part 1 - Add hash code to atoms and use it for Map/Set
This was already landed on ESR45 for the 45.6 release, so I think that makes this more important to ship with 50.1 as well.
Attachment #8811253 -
Flags: approval-mozilla-release?
Comment 26•8 years ago
|
||
Comment 27•8 years ago
|
||
Setting tracking- for fixed bugs seems to conflate bug status with severity and is a dangerous practice in general (What happens if a bug gets backed out? Are we going to rely on luck that it ends up back on RelMan's radar at that point?). Especially for security bugs, can we please stop doing this?
Updated•8 years ago
|
Comment on attachment 8811253 [details] [diff] [review]
Part 1 - Add hash code to atoms and use it for Map/Set
Sec-high, meets the triage bar for inclusion in 50.1.0
Attachment #8811253 -
Flags: approval-mozilla-release? → approval-mozilla-release+
Comment 29•8 years ago
|
||
Needs rebasing for mozilla-release.
Assignee | ||
Comment 30•8 years ago
|
||
Comment 31•8 years ago
|
||
Can't write an advisory for this issue without 0day'ing ESR45 because the fix in ESR45 doesn't ship until January. This should not have gone into 50.1.
Updated•8 years ago
|
Flags: needinfo?(abillings)
Comment 32•8 years ago
|
||
Ok. There is an ESR 45.6 release going out with 50.1. This should be in the advisories for both unless the disclosure precludes that. Jan?
Flags: needinfo?(abillings)
Whiteboard: Disclosure date ~Jan 21 2017 (note Fx51 scheduled for Jan 24) → [adv-main50.1+][adv-ESR45.6+] Disclosure date ~Jan 21 2017 (note Fx51 scheduled for Jan 24)
Assignee | ||
Comment 33•8 years ago
|
||
(In reply to Al Billings [:abillings] from comment #32)
> Ok. There is an ESR 45.6 release going out with 50.1. This should be in the
> advisories for both unless the disclosure precludes that. Jan?
Al, just to be sure, did you mean to ask Jann, the bug reporter?
Flags: needinfo?(jdemooij) → needinfo?(abillings)
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(jdemooij)
Comment 34•8 years ago
|
||
I was trying to understand the whiteboard, "Disclosure date ~Jan 21 2017 (note Fx51 scheduled for Jan 24)".
Dan Veditz says that it shouldn't limit us writing an advisory as it is just indicating when the reporter will be disclosing per his own policy.
Flags: needinfo?(jdemooij)
Flags: needinfo?(dveditz)
Flags: needinfo?(abillings)
Updated•8 years ago
|
Alias: CVE-2016-9904
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(jdemooij)
Updated•8 years ago
|
Flags: needinfo?(dveditz)
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(jdemooij)
Updated•8 years ago
|
Updated•8 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•