Closed
Bug 1334290
Opened 8 years ago
Closed 8 years ago
Truncation in nsScanner
Categories
(Core :: XML, defect)
Tracking
()
People
(Reporter: q1, Assigned: hsivonen)
Details
(Keywords: csectype-intoverflow, reporter-external, sec-moderate, Whiteboard: [post-critsmash-triage][adv-main52+])
Attachments
(1 file)
18.22 KB,
patch
|
mrbkap
:
review+
gchang
:
approval-mozilla-aurora+
jcristau
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
On x64 builds, nsScanner (parser\htmlparser\nsScanner.cpp) truncates the 64-bit |size_t| quantity Distance() into the 32-bit member variables |mCountRemaining| and |mFirstNonWhitespacePosition|. This matters if the nsScanner object represents a string > 4 GB [1].
I do not know the security import of this bug.
[1] This can occur; see, e.g., https://bugzilla.mozilla.org/show_bug.cgi?id=1334246 .
There is also a potential overflow of similar type on the assignment:
mCountRemaining += length;
in nsScanner::UngetReadable().
Updated•8 years ago
|
Group: core-security → dom-core-security
Updated•8 years ago
|
Flags: needinfo?(hsivonen)
Assignee | ||
Comment 2•8 years ago
|
||
I can take a look on Feb 14.
Assignee | ||
Comment 3•8 years ago
|
||
I'm running out of time for today, but it seems that both variables that are problematic are unnecessary to have.
Assignee: nobody → hsivonen
Flags: needinfo?(hsivonen)
Assignee | ||
Comment 4•8 years ago
|
||
We can remove mFirstNonWhitespacePosition by removing the optimization that avoids passing whitespace-only buffers to expat. We can remove mCountRemaining by realizing that we do not need to be able to rewrite the replacement character after the fact. Because about:blank is empty and never has bogus bytes, we can hard-code the XML case to begin with.
Attachment #8837671 -
Flags: review?(mrbkap)
Assignee | ||
Updated•8 years ago
|
Component: HTML: Parser → XML
Updated•8 years ago
|
Attachment #8837671 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 5•8 years ago
|
||
Comment on attachment 8837671 [details] [diff] [review]
Remove useless fields from nsScanner
I have a hard time believing that this would get rated higher than bug 1334246, but requesting approval to follow the process.
[Security approval request comment]
> How easily could an exploit be constructed based on the patch?
It's not clear whether there is an actual exploit to be constructed.
> 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.
> If not all supported branches, which bug introduced the flaw?
Ancient flaw.
> Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Trivial mechanical rebase needed.
> How likely is this patch to cause regressions; how much testing does it need?
Unlikely. A short time on nightly should be enough.
Attachment #8837671 -
Flags: sec-approval?
Comment 6•8 years ago
|
||
> I have a hard time believing that this would get rated higher than bug 1334246,
Sounds reasonable to me. I'll mark it moderate, and then you don't need sec-approval.
Keywords: csectype-intoverflow,
sec-moderate
Updated•8 years ago
|
Attachment #8837671 -
Flags: sec-approval?
Assignee | ||
Comment 7•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f54a857324e4661bfdd67996551fea7201d3127a
Bug 1334290 - Remove useless fields from nsScanner. r=mrbkap.
Comment 8•8 years ago
|
||
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Assignee | ||
Comment 9•8 years ago
|
||
Comment on attachment 8837671 [details] [diff] [review]
Remove useless fields from nsScanner
Approval Request Comment
> [Feature/Bug causing the regression]:
Ancient.
> [User impact if declined]:
Unclear for the truncation. However, this bug also fixes denial of service when Firefox is served an XML file with a very long run of consecutive whitespace.
> [Is this code covered by automated tests?]:
No, because the test would be too large.
> [Has the fix been verified in Nightly?]:
Landed uneventfully on nightly. Verified the fix for the denial of service aspect. Didn't verify anything about truncation, because the offending code was completely deleted and there weren't known symptoms to look for.
> [Needs manual test from QE? If yes, steps to reproduce]:
No.
> [List of other uplifts needed for the feature/fix]:
Requires bug 1334246.
> [Is the change risky?]:
No.
> [Why is the change risky/not risky?]:
Deletion of useless code whose removal is believed to be understood.
> [String changes made/needed]:
None.
Attachment #8837671 -
Flags: approval-mozilla-beta?
Attachment #8837671 -
Flags: approval-mozilla-aurora?
Updated•8 years ago
|
status-firefox51:
--- → wontfix
status-firefox52:
--- → affected
status-firefox53:
--- → affected
status-firefox-esr45:
--- → wontfix
status-firefox-esr52:
--- → affected
tracking-firefox52:
--- → ?
tracking-firefox53:
--- → ?
tracking-firefox54:
--- → ?
tracking-firefox-esr52:
--- → ?
Comment 11•8 years ago
|
||
Comment on attachment 8837671 [details] [diff] [review]
Remove useless fields from nsScanner
Fix a security issue. Aurora53+.
Attachment #8837671 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 12•8 years ago
|
||
Comment on attachment 8837671 [details] [diff] [review]
Remove useless fields from nsScanner
companion change for bug 1334246, let's get this one in 52.0b9 too.
Attachment #8837671 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment 13•8 years ago
|
||
uplift |
Updated•8 years ago
|
Comment 14•8 years ago
|
||
uplift |
Updated•8 years ago
|
Flags: sec-bounty+
Updated•8 years ago
|
Group: dom-core-security → core-security-release
Comment 15•8 years ago
|
||
uplift |
Updated•8 years ago
|
Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Updated•8 years ago
|
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main52+]
Updated•7 years ago
|
Group: core-security-release
Updated•11 months ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•