Closed
Bug 1473113
(CVE-2018-12379)
Opened 7 years ago
Closed 6 years ago
Invalid memcpy in mar_read.c
Categories
(Toolkit :: Application Update, defect, P2)
Tracking
()
People
(Reporter: hofusec, Assigned: molly)
Details
(Keywords: csectype-bounds, reporter-external, sec-moderate, Whiteboard: [post-critsmash-triage][adv-main62+][adv-esr60.2+])
Attachments
(2 files)
2.40 MB,
application/zip
|
Details | |
3.00 KB,
patch
|
robert.strong.bugs
:
review+
RyanVM
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-esr60+
abillings
:
sec-approval+
|
Details | Diff | Splinter Review |
By opening a mar file which contains a very long item file name (length = max int) it's possible to trigger an invalid memcpy call. This can lead to an out-of-bounds read/write.
To reproduce extract the update.mar and try an update with an 64bit updater or use the mar tool like 'mar -t ./update.mar'
ASAN-Log:
==11754==ERROR: AddressSanitizer: negative-size-param: (size=-2147483648)
#0 0x4bdeb4 in __asan_memcpy moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cc:23:3
#1 0x500c2a in mar_insert_item src/modules/libmar/src/mar_read.c:44:3
#2 0x500c2a in mar_consume_index src/modules/libmar/src/mar_read.c:109
#3 0x500c2a in mar_read_index src/modules/libmar/src/mar_read.c:142
#4 0x500c2a in mar_fpopen src/modules/libmar/src/mar_read.c:164
#5 0x500c2a in mar_open src/modules/libmar/src/mar_read.c:182
#6 0x4efa94 in ArchiveReader::Open(char const*) src/toolkit/mozapps/update/updater/archivereader.cpp:209:14
#7 0x4f908d in UpdateThreadFunc(void*) src/toolkit/mozapps/update/updater/updater.cpp:2480:27
...
Comment 1•7 years ago
|
||
Why aren't we validating (and in this case rejecting) the .mar signature before doing _anything_ else with a potentially evil fake update?
Haven't looked into it but let's start with "sec-high" and hope that's an over-estimate.
Keywords: sec-high
Updated•7 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•7 years ago
|
Priority: -- → P2
Assignee | ||
Comment 2•7 years ago
|
||
This is definitely a real out of bounds write. I'm not sure if it would end up being exploitable in practice, but it's definitely at least a crash.
I can't see a reason why we need to parse the index before we check the signature. I'll work on changing that.
Assignee: nobody → mhowell
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•7 years ago
|
||
Assignee | ||
Comment 4•7 years ago
|
||
Assignee | ||
Comment 5•7 years ago
|
||
Attachment #8991507 -
Flags: review?(robert.strong.bugs)
Updated•6 years ago
|
Attachment #8991507 -
Flags: review?(robert.strong.bugs) → review+
Assignee | ||
Comment 6•6 years ago
|
||
Comment on attachment 8991507 [details] [diff] [review]
Patch
[Security approval request comment]
How easily could an exploit be constructed based on the patch?
In my opinion the patch does not point to a specific exploit.
Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
I do not believe so.
Which older supported branches are affected by this flaw?
All supported branches.
If not all supported branches, which bug introduced the flaw?
N/A
Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Backports should be trivial to create and would likely be identical to the patch here; the affected code has not been under active development on any supported branch.
How likely is this patch to cause regressions; how much testing does it need?
Unlikely because the patch is straightforward and solid automated testing coverage exists. However as with any updater patch giving it a few days on Nightly before approving any uplifts would be a worthwhile precaution.
Attachment #8991507 -
Flags: sec-approval?
Comment 7•6 years ago
|
||
sec-approval+ for trunk. Can you nominate ESR60 and Beta patches for approval and checkin after this is on trunk a few days?
status-firefox61:
--- → wontfix
status-firefox62:
--- → affected
status-firefox63:
--- → unaffected
status-firefox-esr52:
--- → wontfix
status-firefox-esr60:
--- → affected
tracking-firefox62:
--- → +
tracking-firefox63:
--- → +
tracking-firefox-esr60:
--- → 62+
Flags: needinfo?(mhowell)
Updated•6 years ago
|
Attachment #8991507 -
Flags: sec-approval? → sec-approval+
Assignee | ||
Comment 8•6 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/21c86ca04f868e7e8a95eac2fa9288f31ccd7fa1
Bug 1473113 - Defer initializing the MAR index until it's needed. r=rstrong
Comment 9•6 years ago
|
||
Group: toolkit-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Updated•6 years ago
|
Flags: sec-bounty?
Updated•6 years ago
|
Assignee | ||
Comment 10•6 years ago
|
||
Comment on attachment 8991507 [details] [diff] [review]
Patch
I think it's been long enough, I haven't seen any problems or reports of problems. As I suspected it would, this patch applies cleanly to beta and ESR 60.
[ESR Approval Request Comment]
If this is not a sec:{high,crit} bug, please state case for ESR consideration:
This is a sec-high bug.
User impact if declined:
Potential for privilege elevation via updater exploit.
Fix Landed on Version:
63
Risk to taking this patch (and alternatives if risky):
Risk is low because the patch is straightforward and has both been through the updater automated testing and also been given a trial run on nightly for several days.
String or UUID changes made by this patch:
None
[Beta Approval Request Comment]
[Feature/Bug causing the regression]:
This bug has probably always been there; I didn't look past where the hg history starts, but it appears to have been there already by then.
[Is this code covered by automated tests?]:
Yes
[Has the fix been verified in Nightly?]:
Yes
[Needs manual test from QE? If yes, steps to reproduce]:
No
[List of other uplifts needed for the feature/fix]:
None
Flags: needinfo?(mhowell)
Attachment #8991507 -
Flags: approval-mozilla-esr60?
Attachment #8991507 -
Flags: approval-mozilla-beta?
Comment 11•6 years ago
|
||
Comment on attachment 8991507 [details] [diff] [review]
Patch
Fixes a sec-high. Approved for 62.0b16 and ESR 60.2.
Attachment #8991507 -
Flags: approval-mozilla-esr60?
Attachment #8991507 -
Flags: approval-mozilla-esr60+
Attachment #8991507 -
Flags: approval-mozilla-beta?
Attachment #8991507 -
Flags: approval-mozilla-beta+
Comment 12•6 years ago
|
||
uplift |
Updated•6 years ago
|
Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Updated•6 years ago
|
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main62+][adv-esr60.2+]
Updated•6 years ago
|
Flags: sec-bounty? → sec-bounty+
Updated•6 years ago
|
Alias: CVE-2018-12379
Updated•5 years ago
|
Group: core-security-release
Updated•8 months ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•