Closed
Bug 945939
Opened 11 years ago
Closed 11 years ago
Use-after-free or worse in ValueNumberer::lookupValue
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
People
(Reporter: terrence, Assigned: terrence)
Details
(Keywords: csectype-uaf, sec-high, Whiteboard: [qa-][adv-main27+][adv-esr24.3+])
Attachments
(1 file, 1 obsolete file)
1.14 KB,
patch
|
sunfish
:
review+
abillings
:
approval-mozilla-beta+
abillings
:
approval-mozilla-esr24+
abillings
:
sec-approval+
|
Details | Diff | Splinter Review |
In ValueNumberer::lookupValue, we acquire a pointer |p| into the hashtable, then breakClass -- this may (and does in practice) modify the table -- then return p->value. If breakClass's modifications cause a table resize, p->value will return a random table entry, freed garbage, or even a different threads memory. This could cause an untold litany of immediate or subtle downstream damage, but is probably quite hard to exploit in practice. I think we want the pre-broken instruction id here instead, but I'm not familiar enough with our implementation of the algorithm to be 100% sure.
Attachment #8341956 -
Flags: review?(sunfish)
Comment 1•11 years ago
|
||
Comment on attachment 8341956 [details] [diff] [review] fix_valuenumber-v0.diff Review of attachment 8341956 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/ValueNumbering.cpp @@ +40,5 @@ > return 0; > breakClass(ins); > } > > + return ins->id(); This function needs to return p->value in the case where the value was already in the map. Fortunately, there's no breakClass on that path, so that should be doable. Returning ins->id() looks correct only for the case where the item was not already present in the map.
Attachment #8341956 -
Flags: review?(sunfish) → review-
Assignee | ||
Comment 2•11 years ago
|
||
Great! That's exactly what I needed to know.
Attachment #8341956 -
Attachment is obsolete: true
Attachment #8342454 -
Flags: review?(sunfish)
Comment 3•11 years ago
|
||
Comment on attachment 8342454 [details] [diff] [review] fix_valuenumber-v1.diff Looks good to me. There's a patch conflict with the patch in bug 940033 but it should be trivial to resolve.
Attachment #8342454 -
Flags: review?(sunfish) → review+
Assignee | ||
Comment 4•11 years ago
|
||
Comment on attachment 8342454 [details] [diff] [review] fix_valuenumber-v1.diff [Security approval request comment] How easily could an exploit be constructed based on the patch? Not easily. Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem? Not really. It's pretty subtle unless you're intimately familiar with the value numbering algorithm and our specific hashtable implementation. Which older supported branches are affected by this flaw? All of them. If not all supported branches, which bug introduced the flaw? Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be? This should be easy/trivial to backport. How likely is this patch to cause regressions; how much testing does it need? This shouldn't need more than a single green tbpl run to verify.
Attachment #8342454 -
Flags: sec-approval?
Updated•11 years ago
|
Keywords: csectype-uaf,
sec-high
Comment 5•11 years ago
|
||
Comment on attachment 8342454 [details] [diff] [review] fix_valuenumber-v1.diff (Discussed this with DVeditz). sec-approval+ for trunk. You should make an ESR and Aurora patches. Beta is too close to shipping.
Attachment #8342454 -
Flags: sec-approval? → sec-approval+
Updated•11 years ago
|
status-b2g18:
--- → affected
status-b2g-v1.1hd:
--- → affected
status-b2g-v1.2:
--- → affected
status-firefox26:
--- → wontfix
status-firefox27:
--- → affected
status-firefox28:
--- → affected
status-firefox29:
--- → affected
status-firefox-esr24:
--- → affected
tracking-firefox-esr24:
--- → 27+
Assignee | ||
Comment 6•11 years ago
|
||
Landed on m-i with a misleading summary. https://hg.mozilla.org/integration/mozilla-inbound/rev/0f3f132e2198
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/0f3f132e2198
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Assignee | ||
Comment 8•11 years ago
|
||
This was discovered through assertions; there is no way to test it.
Flags: in-testsuite? → in-testsuite-
Comment 9•11 years ago
|
||
Can we get uplift noms?
status-firefox29:
affected → ---
Flags: needinfo?(terrence)
Assignee | ||
Comment 10•11 years ago
|
||
Comment on attachment 8342454 [details] [diff] [review] fix_valuenumber-v1.diff Thanks for the heads-up, Ryan! I wasn't sure what the next step was. [Approval Request Comment] Bug caused by (feature/regressing bug #): Bug 723536. User impact if declined: A sec-high vulnerability. Testing completed (on m-c, etc.): Has been on m-c for a week. Risk to taking this patch (and alternatives if risky): Low. String or IDL/UUID changes made by this patch: None.
Attachment #8342454 -
Flags: approval-mozilla-esr24?
Attachment #8342454 -
Flags: approval-mozilla-beta?
Attachment #8342454 -
Flags: approval-mozilla-b2g28?
Attachment #8342454 -
Flags: approval-mozilla-b2g26?
Attachment #8342454 -
Flags: approval-mozilla-b2g18?
Comment 11•11 years ago
|
||
Comment on attachment 8342454 [details] [diff] [review] fix_valuenumber-v1.diff b2g28 = Aurora, so we're good :)
Attachment #8342454 -
Flags: approval-mozilla-b2g28?
Updated•11 years ago
|
status-b2g-v1.3:
--- → fixed
Flags: needinfo?(terrence)
Updated•11 years ago
|
Attachment #8342454 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Updated•11 years ago
|
Attachment #8342454 -
Flags: approval-mozilla-esr24? → approval-mozilla-esr24+
Comment 12•11 years ago
|
||
Comment on attachment 8342454 [details] [diff] [review] fix_valuenumber-v1.diff sec-highs tracking an ESR have automatic approval :)
Attachment #8342454 -
Flags: approval-mozilla-b2g26?
Attachment #8342454 -
Flags: approval-mozilla-b2g18?
Comment 13•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-beta/rev/3cd5bb2dddcd https://hg.mozilla.org/releases/mozilla-esr24/rev/976801762cff https://hg.mozilla.org/releases/mozilla-b2g26_v1_2/rev/eb10223c6661 https://hg.mozilla.org/releases/mozilla-b2g18/rev/bdac595a4e46
Comment 15•11 years ago
|
||
Terrence, can you please advise QA on if/how we should verify this is fixed?
Flags: needinfo?(terrence)
Assignee | ||
Comment 16•11 years ago
|
||
(In reply to Anthony Hughes, QA Mentor (:ashughes) from comment #15) > Terrence, can you please advise QA on if/how we should verify this is fixed? No verification is needed here. This flaw was discovered by manual analysis and there was never any attack crafted against it.
Flags: needinfo?(terrence)
Comment 17•11 years ago
|
||
Thanks Terrence, tagging as [qa-]. Feel free to pre-emptively mark bugs not needing QA verification with [qa-] in the future.
Whiteboard: [qa-]
Updated•10 years ago
|
Whiteboard: [qa-] → [qa-][adv-main27+][adv-esr24.3+]
Updated•10 years ago
|
status-b2g-v1.3T:
--- → fixed
Updated•9 years ago
|
Group: core-security
You need to log in
before you can comment on or make changes to this bug.
Description
•