Closed
Bug 1182723
(CVE-2015-4489)
Opened 10 years ago
Closed 10 years ago
Self-assignment in nsTArray_Impl causes memory-safety bug
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla42
People
(Reporter: q1, Assigned: poiru)
References
Details
(Keywords: csectype-uaf, reporter-external, sec-high, Whiteboard: [post-critsmash-triage][adv-main40+][adv-esr38.2+])
Attachments
(2 files)
2.50 KB,
patch
|
mccr8
:
review+
abillings
:
sec-approval+
|
Details | Diff | Splinter Review |
1.38 KB,
patch
|
abillings
:
approval-mozilla-aurora+
abillings
:
approval-mozilla-beta+
abillings
:
approval-mozilla-esr38+
|
Details | Diff | Splinter Review |
Assigning an array object based upon nsTArray_Impl to itself causes the destruction of the array's elements, followed by the construction of new elements from the memory that contained the destroyed elements. If the element type has a nontrivial destructor, this almost certainly results in the construction of invalid new elements, such as those containing pointers to unowned memory.
The bug is that the copy-assignment operator does not check for self-assignment.
I do not know whether any code actually does such a self-assignment.
There is also a similar bug in the move-assignment operator, which is less serious because it clears the object, then assigns it to itself.
![]() |
||
Updated•10 years ago
|
Flags: needinfo?(nfroyd)
Updated•10 years ago
|
Flags: sec-bounty?
Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8633045 -
Flags: review?(continuation)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → birunthan
Status: NEW → ASSIGNED
Comment 2•10 years ago
|
||
Comment on attachment 8633045 [details] [diff] [review]
Properly handle self-assignment in nsTArray::operator=
Review of attachment 8633045 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for fixing this. Sorry for the delay in my review.
Do you think it is likely that we're hitting this issue in the codebase? That will affect whether we need to backport this and (maybe) the security rating. I guess you could do a try push that just crashes on self-assignment as a basic smoke test.
Attachment #8633045 -
Flags: review?(continuation) → review+
Updated•10 years ago
|
Flags: needinfo?(nfroyd)
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #2)
> Do you think it is likely that we're hitting this issue in the codebase?
> That will affect whether we need to backport this and (maybe) the security
> rating. I guess you could do a try push that just crashes on self-assignment
> as a basic smoke test.
We seem to be: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6190cff0f3e2 (please ignore the build oranges, I forgot to remove the test)
Assignee | ||
Comment 4•10 years ago
|
||
Comment on attachment 8633045 [details] [diff] [review]
Properly handle self-assignment in nsTArray::operator=
[Security approval request comment]
How easily could an exploit be constructed based on the patch?
Not sure.
Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
The patch is obvious so an empty commit message is probably as much of a bulls-eye as a clear commit message.
Which older supported branches are affected by this flaw?
All (release, esr, etc.).
Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Easy, no risk.
How likely is this patch to cause regressions; how much testing does it need?
Very unlikely.
Attachment #8633045 -
Flags: sec-approval?
Comment 5•10 years ago
|
||
(In reply to Birunthan Mohanathas [:poiru] from comment #3)
> We seem to be:
Thanks for checking. Seems like there's enough that I'll just mark this as sec-high, though some of those cases might be benign arrays with elements with boring data types.
Keywords: csectype-uaf,
sec-high
Comment 6•10 years ago
|
||
sec-approval+. We should also get patches made and nominated for Aurora, Beta, and ESR38.
status-firefox39:
--- → wontfix
status-firefox40:
--- → affected
status-firefox41:
--- → affected
status-firefox-esr31:
--- → wontfix
status-firefox-esr38:
--- → affected
tracking-firefox40:
--- → +
tracking-firefox41:
--- → +
tracking-firefox42:
--- → +
tracking-firefox-esr38:
--- → 40+
Updated•10 years ago
|
Attachment #8633045 -
Flags: sec-approval? → sec-approval+
Assignee | ||
Comment 7•10 years ago
|
||
Assignee | ||
Comment 8•10 years ago
|
||
This is a version of the patch without tests because the older branches don't have TestTArray.cpp. The patch is trivial and the test is green on 42 so we don't need a test on the older branches.
[Approval Request Comment]
Fix Landed on Version: 42
Risk to taking this patch (and alternatives if risky): Minimal
String or UUID changes made by this patch: None
This should land along with bug 1185589. Order does not matter.
Attachment #8636665 -
Flags: approval-mozilla-esr38?
Attachment #8636665 -
Flags: approval-mozilla-beta?
Attachment #8636665 -
Flags: approval-mozilla-aurora?
Comment 9•10 years ago
|
||
Comment on attachment 8636665 [details] [diff] [review]
esr38/40/41 patch without tests
Branch patches approved.
We probably should have landed the trunk one without a test. I missed that you included one. Too late now though.
Attachment #8636665 -
Flags: approval-mozilla-esr38?
Attachment #8636665 -
Flags: approval-mozilla-esr38+
Attachment #8636665 -
Flags: approval-mozilla-beta?
Attachment #8636665 -
Flags: approval-mozilla-beta+
Attachment #8636665 -
Flags: approval-mozilla-aurora?
Attachment #8636665 -
Flags: approval-mozilla-aurora+
Comment 10•10 years ago
|
||
The C++ doesn't make it any more obvious or easier to exploit than the code change itself.
Comment 11•10 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #10)
> The C++ doesn't make it any more obvious or easier to exploit than the code
> change itself.
Err... the C++ test, I meant.
Comment 12•10 years ago
|
||
(In reply to Birunthan Mohanathas [:poiru] from comment #7)
> https://hg.mozilla.org/integration/mozilla-inbound/rev/bcf65c04b69c
This landed with the wrong bug # in the commit message.
https://hg.mozilla.org/mozilla-central/rev/bcf65c04b69c
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Comment 13•10 years ago
|
||
status-b2g-v2.0:
--- → affected
status-b2g-v2.0M:
--- → affected
status-b2g-v2.1:
--- → affected
status-b2g-v2.1S:
--- → affected
status-b2g-v2.2:
--- → affected
status-b2g-v2.2r:
--- → affected
status-b2g-master:
--- → fixed
Flags: in-testsuite+
Comment 14•10 years ago
|
||
Comment 15•10 years ago
|
||
Comment 16•10 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g37_v2_2/rev/4eed95ec3b02
https://hg.mozilla.org/releases/mozilla-b2g37_v2_2r/rev/4eed95ec3b02
https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/55edd9de0b57
https://hg.mozilla.org/releases/mozilla-b2g34_v2_1s/rev/55edd9de0b57
https://hg.mozilla.org/releases/mozilla-b2g32_v2_0/rev/2e6f1d4deff9
https://hg.mozilla.org/releases/mozilla-b2g32_v2_0m/rev/2e6f1d4deff9
Updated•10 years ago
|
Whiteboard: [post-critsmash-triage]
Updated•10 years ago
|
Flags: sec-bounty? → sec-bounty+
Updated•10 years ago
|
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main40+][adv-esr38.2+]
Updated•10 years ago
|
Alias: CVE-2015-4489
Updated•10 years ago
|
Group: core-security
Updated•9 months ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•