Closed
Bug 1500011
(CVE-2018-18498)
Opened 6 years ago
Closed 6 years ago
Unsafe use of CheckedInt32 in nsContentUtils::CalculateBufferSizeForImage
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla65
People
(Reporter: r2, Assigned: nika)
References
Details
(4 keywords, Whiteboard: [post-critsmash-triage][adv-main64+][adv-esr60.4+])
Attachments
(1 file)
46 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-esr60+
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:61.0) Gecko/20100101 Firefox/61.0
Steps to reproduce:
This is the same issue as bug#1495011.
nsresult
nsContentUtils::CalculateBufferSizeForImage(const uint32_t& aStride,
const IntSize& aImageSize,
const SurfaceFormat& aFormat,
size_t* aMaxBufferSize,
size_t* aUsedBufferSize)
{
CheckedInt32 requiredBytes =
CheckedInt32(aStride) * CheckedInt32(aImageSize.height);
if (!requiredBytes.isValid()) {
return NS_ERROR_FAILURE;
}
*aMaxBufferSize = requiredBytes.value();
*aUsedBufferSize = *aMaxBufferSize - aStride + (aImageSize.width * BytesPerPixel(aFormat));
return NS_OK;
}
https://searchfox.org/mozilla-central/source/dom/base/nsContentUtils.cpp#7863
requiredBytes is checked for an overflow, however a couple of lines later its raw unchecked value is used in arithmetic calculations again. Thus aUsedBufferSize can potentially overflow on x86 systems.
Updated•6 years ago
|
Group: firefox-core-security → dom-core-security
Component: Untriaged → DOM
Product: Firefox → Core
Comment 1•6 years ago
|
||
Looks like this was introduced in bug 1473161 which was also a sec bug and backported to esr60. Nika, you reviewed, can you take a look or pass this onto someone else who can?
Blocks: 1473161
Flags: needinfo?(nika)
Assignee | ||
Comment 2•6 years ago
|
||
Assignee | ||
Comment 3•6 years ago
|
||
I've changed it to use CheckedInt32 more pervasively - thanks.
Assignee: nobody → nika
Flags: needinfo?(nika)
![]() |
||
Comment 4•6 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/a3fad30f081a0bcd4aeae913942fc360dbdbf30e
https://hg.mozilla.org/mozilla-central/rev/a3fad30f081a
Group: dom-core-security → core-security-release
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Comment 5•6 years ago
|
||
This needs a sec rating (and potentially a retroactive sec approval request depending on severity).
status-firefox63:
--- → wontfix
status-firefox64:
--- → affected
status-firefox-esr60:
--- → affected
tracking-firefox64:
--- → +
tracking-firefox65:
--- → +
tracking-firefox-esr60:
--- → 64+
Flags: needinfo?(nika)
Keywords: regression
Assignee | ||
Comment 6•6 years ago
|
||
Comment on attachment 9018379 [details]
Bug 1500011 - Use CheckedInt more in CalculateBufferSizeForImage,
[Beta/Release Uplift Approval Request]
Feature/Bug causing the regression: None
User impact if declined: potential parent process memory error with content process code execution.
Is this code covered by automated tests?: Yes
Has the fix been verified in Nightly?: Yes
Needs manual test from QE?: No
If yes, steps to reproduce:
List of other uplifts needed: None
Risk to taking this patch: Low
Why is the change risky/not risky? (and alternatives if risky): Minor obviously-correct changes to small function
String changes made/needed: None
[ESR Uplift Approval Request]
If this is not a sec:{high,crit} bug, please state case for ESR consideration: Low impact
User impact if declined: potential parent process memory error with content process code execution.
Fix Landed on Version:
Risk to taking this patch: Low
Why is the change risky/not risky? (and alternatives if risky): Minor obviously-correct changes to small function
String or UUID changes made by this patch: None
Flags: needinfo?(nika)
Attachment #9018379 -
Flags: approval-mozilla-esr60?
Attachment #9018379 -
Flags: approval-mozilla-beta?
Assignee | ||
Comment 7•6 years ago
|
||
I think this is sec-low btw.
Comment 8•6 years ago
|
||
Comment on attachment 9018379 [details]
Bug 1500011 - Use CheckedInt more in CalculateBufferSizeForImage,
Fixes a minor sec issue, approved for 64.0b4. We'll revisit the ESR request later in the cycle.
Attachment #9018379 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment 9•6 years ago
|
||
uplift |
Updated•6 years ago
|
Keywords: csectype-intoverflow,
sec-low
Updated•6 years ago
|
Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Comment 10•6 years ago
|
||
Comment on attachment 9018379 [details]
Bug 1500011 - Use CheckedInt more in CalculateBufferSizeForImage,
Seems pretty low-impact, but keeps our code consistent across releases anyway and very low-risk. Approved for 60.4.0esr.
Attachment #9018379 -
Flags: approval-mozilla-esr60? → approval-mozilla-esr60+
Comment 11•6 years ago
|
||
uplift |
Updated•6 years ago
|
Flags: sec-bounty?
Updated•6 years ago
|
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main64+][adv-esr60.4+]
Updated•6 years ago
|
Alias: CVE-2018-18498
Updated•6 years ago
|
Summary: Unsafe use of CheckedInt32 #2 → Unsafe use of CheckedInt32 in nsContentUtils::CalculateBufferSizeForImage
Comment 12•6 years ago
|
||
Sadly sec-low bugs do not qualify for the bug bounty program
Flags: sec-bounty? → sec-bounty-
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•6 years ago
|
Group: core-security-release
Updated•5 years ago
|
Flags: sec-bounty-hof+
Updated•9 months ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•