crash in nsZipArchive::GetDataOffset(nsZipItem*)
Categories
(Core :: Networking: JAR, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox41 | --- | wontfix |
| firefox46 | --- | wontfix |
| firefox47 | --- | wontfix |
| firefox48 | --- | wontfix |
| firefox49 | --- | wontfix |
| thunderbird_esr38 | --- | wontfix |
| firefox-esr102 | --- | wontfix |
| firefox-esr115 | --- | wontfix |
| firefox-esr128 | --- | wontfix |
| firefox-esr140 | 148+ | fixed |
| firefox75 | --- | wontfix |
| firefox76 | --- | wontfix |
| firefox106 | --- | wontfix |
| firefox107 | --- | wontfix |
| firefox108 | --- | wontfix |
| firefox131 | --- | wontfix |
| firefox147 | --- | wontfix |
| firefox148 | + | fixed |
| firefox149 | + | fixed |
People
(Reporter: alex_mayorga, Assigned: valentin)
References
Details
(4 keywords, Whiteboard: ShutDownKill, [necko-triaged][necko-priority-queue][adv-main148+] [adv-esr140.8+])
Crash Data
Attachments
(4 files, 1 obsolete file)
|
48 bytes,
text/x-phabricator-request
|
dveditz
:
sec-approval+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr140+
|
Details | Review |
Updated•11 years ago
|
Comment 1•11 years ago
|
||
Updated•10 years ago
|
Comment 2•10 years ago
|
||
Updated•10 years ago
|
Comment 4•10 years ago
|
||
| Reporter | ||
Comment 6•9 years ago
|
||
Comment 7•8 years ago
|
||
Comment 8•8 years ago
|
||
| Reporter | ||
Updated•6 years ago
|
Comment 9•3 years ago
|
||
Since the crash volume is low (less than 5 per week), the severity is downgraded to S3. Feel free to change it back if you think the bug is still critical.
For more information, please visit auto_nag documentation.
Comment 10•3 years ago
•
|
||
This appears to be a bounds-overrun due to (most likely) a corrupt jar file. Comment from a user indicates it's a repeatable startup crash for them (Mac).
Most crashes are Mac ESR78; the crashes are from Android 94+, and Mac 106. (plus a single Mac 80 crash).
uint32_t len = mFd->mLen;
const uint8_t* data = mFd->mFileData;
offset = aItem->LocalOffset();
if (len < ZIPLOCAL_SIZE || offset > len - ZIPLOCAL_SIZE) return 0;
// -- check signature before using the structure, in case the zip file is
// corrupt
ZipLocal* Local = (ZipLocal*)(data + offset);
-> if ((xtolong(Local->signature) != LOCALSIG)) return 0;
From that, one guess is that offset is corrupt, and we're indexing past the end of the data somehow. We shouldn't be, since there is a length check, and it subtracts the length of ZipLocal for the check. Perhaps there's an issue with the data for the Zip, and for some reason the memory referenced by mFd isn't accessible.
Comment 11•3 years ago
|
||
It's also very interesting that the errors are basically android-only now, and were (quite a while ago) Mac-only.
Comment 13•3 years ago
|
||
Windows crashes are all in shutdown.... very odd.
Updated•3 years ago
|
Comment 14•3 years ago
|
||
The severity field for this bug is set to S3. However, the bug is flagged with the sec-high keyword.
:jesup, could you consider increasing the severity of this security bug?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Comment 15•3 years ago
|
||
Comment 16•3 years ago
|
||
Comment on attachment 9301455 [details]
Bug 1164141: ZipArchive cleanup r=#necko
Security Approval Request
- How easily could an exploit be constructed based on the patch?: Very hard
- 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?: None
- Do you have backports for the affected branches?: No
- If not, how different, hard to create, and risky will they be?: Trivial, no risk
- How likely is this patch to cause regressions; how much testing does it need?: Very unlikely to cause regressions. Diagnostic patch (and returns error for a specific corruption, which we don't think is happening)
- Is Android affected?: Yes
Comment 17•3 years ago
|
||
Comment on attachment 9301455 [details]
Bug 1164141: ZipArchive cleanup r=#necko
Approved to land and request uplift if desired
Comment 18•3 years ago
|
||
ZipArchive cleanup r=necko-reviewers,valentin
https://hg.mozilla.org/integration/autoland/rev/1b442368d5670a54cb29aa8e7355824c2dfb3364
https://hg.mozilla.org/mozilla-central/rev/1b442368d567
Comment 19•3 years ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit auto_nag documentation.
Comment 20•3 years ago
|
||
The patch landed in nightly and beta is affected.
:jesup, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox107towontfix.
For more information, please visit auto_nag documentation.
Comment 21•3 years ago
|
||
IMO, we should let this bake a cycle rather than trying to get it into Beta right before RC week. That said, are we planning to handle any follow-up work in a new bug at this point (given that this patch seems more diagnostic in nature)?
Comment 22•3 years ago
|
||
This is almost entirely diagnostic (though it fixes one unlikely edgecase). I'd let it ride on Nightly. And I forgot leave-open
Updated•3 years ago
|
Comment 23•3 years ago
|
||
Comment on attachment 9301455 [details]
Bug 1164141: ZipArchive cleanup r=#necko
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: Cleanup patch (which I wouldn't nominate), but adds one small fix and diagnostic asserts (though that will have no impact on ESR).
- User impact if declined: Missing one error case for corrupted files
- Fix Landed on Version: 108
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): No functional changes other that returning an error for a specific type of corrupted file
Comment 24•3 years ago
•
|
||
Comment on attachment 9301455 [details]
Bug 1164141: ZipArchive cleanup r=#necko
Needed for bug 1801102 to graft cleanly, no expected functional impact otherwise. Approved for 102.6esr.
Comment 25•3 years ago
|
||
| uplift | ||
Comment on attachment 9301455 [details]
Bug 1164141: ZipArchive cleanup r=#necko
Landed on ESR102. Removing the approval flag to get this off the needs-uplift radar.
https://hg.mozilla.org/releases/mozilla-esr102/rev/32629cc89898
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 27•3 years ago
|
||
(In reply to Randell Jesup [:jesup] (needinfo me) from comment #11)
It's also very interesting that the errors are basically android-only now, and were (quite a while ago) Mac-only.
The Mac crashes are back. There are also still Android crashes. They appear to be two different things.
Android is crashing on a null dereference on the line "uint32_t len = mFd->mLen" -- mFd must be null. Is there a missing check that the archive was opened/initted successfully? I don't see how the caller could get an nsZipItem to pass in to GetDataOffset() if mFd were null.
The Mac crashes are still like comment 10 so they've gotten a little further than the Android crashes.
| Assignee | ||
Comment 28•3 years ago
|
||
I'm adding a few null checks and diagnostic asserts in https://phabricator.services.mozilla.com/D178986
There are a few places like these these ones that don't really check if the zip item is null before using it (assuming the call to item->RealSize doesn't crash), but these don't really show up in the stack traces so there must be something else going on.
If we land the diagnostic patch we might get some more info regarding what's causing the issue.
Updated•2 years ago
|
Comment 29•1 year ago
|
||
https://crash-stats.mozilla.org/signature/?signature=shutdownhang%20%7C%20nsZipArchive%3A%3AGetDataOffset&date=%3E%3D2024-08-28T18%3A15%3A00.000Z&date=%3C2024-09-04T18%3A15%3A00.000Z&_columns=date&_columns=product&_columns=version&_columns=build_id&_columns=platform&_columns=reason&_columns=address&_columns=moz_crash_reason&_sort=-date&page=1
shows that the windows crashes are pretty much all breakpoints, with comments in MOZ_REASON of stuff like Shutdown hanging at step AppShutdown. Something is blocking the main-thread. Most have shutdown phase entries on the stack. OTOH the linux and (mostly) mac crashes almost entirely do not have shutdown phase stack entries
| Reporter | ||
Comment 30•1 year ago
|
||
Β‘Hola y'all!
Updating flags per what's visible over at
Β‘Gracias!
Alex
Updated•1 year ago
|
| Assignee | ||
Comment 31•5 months ago
|
||
I got claude to have a look at this after I noticed that crashes don't seem to happen on Windows, which means the mmap fault handler was wrong, and it pointed out that the condition:
https://searchfox.org/firefox-main/rev/d6dfd9f8cd9717b03750cded8980ef61678fbc8b/mozglue/misc/MmapFaultHandler.h#86
if (ValidFD(fd) && fd->mMap) { \
doesn't hold for memory mapped handles, such as when we have nested archives.
It also turns out we were trying to debug this in bug 1583735, and still have CrashWithInfo crashes.
The fix seems to be changing that line to ValidFD(fd) && fd->mFileStart && fd->mTotalLen > 0
I'm currently trying to get a good gtest to actually reproduce this.
| Assignee | ||
Comment 32•5 months ago
|
||
| Assignee | ||
Comment 33•5 months ago
|
||
| Assignee | ||
Comment 34•5 months ago
|
||
Test crashes without patch, but works with it π
Updated•5 months ago
|
Comment 35•5 months ago
•
|
||
Comment on attachment 9544143 [details]
(secure)
Setting flag for valentin due to a bug in BMO!?
| Assignee | ||
Comment 36•5 months ago
|
||
Comment on attachment 9544142 [details]
(secure)
Security Approval Request
- How easily could an exploit be constructed based on the patch?:
Not easy. The patch does 2 things:
- Handle SIGBUS faults for even if fd->mMap is null. This is the case when the JAR archive is nested inside another one.
- Removes the CrashWithInfo added to diagnose why the crashes were still happening.
The SIGBUS is triggered when the mmaped file is truncated, and then Firefox accesses the mmaped memory. The mapped memory range's shouldn't change, so nothing else should be allocated at that address.
Also, these JAR files should not normally change while Firefox is in use.
- 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 branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: All
- If not all supported branches, which bug introduced the flaw?: Long standing issue.
- Do you have backports for the affected branches?: Yes
- If not, how different, hard to create, and risky will they be?: N/A
- How likely is this patch to cause regressions; how much testing does it need?: unlikely to cause regressions.
- Is the patch ready to land after security approval is given?: Yes
- Is Android affected?: Yes
| Assignee | ||
Updated•5 months ago
|
Updated•5 months ago
|
| Comment hidden (duplicate) |
Updated•5 months ago
|
Updated•5 months ago
|
Comment 38•5 months ago
|
||
Comment on attachment 9544142 [details]
(secure)
sec-approval+
Comment 39•5 months ago
|
||
Comment on attachment 9544143 [details]
(secure)
hold off on landing the tests until after the fix ships
Updated•5 months ago
|
Comment 40•5 months ago
|
||
Comment 41•5 months ago
|
||
The bug is marked as tracked for firefox148 (beta) and tracked for firefox149 (nightly). However, the bug still has low priority.
:ghess, could you please increase the priority for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•5 months ago
|
| Assignee | ||
Updated•5 months ago
|
Comment 42•5 months ago
|
||
:valentin could you add uplift requests now for Beta and ESR140? So it's ready for me to uplift before Monday
Comment 43•5 months ago
|
||
| Assignee | ||
Updated•5 months ago
|
Comment 44•5 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Crashes when accessing mmapped memory belonging to nested jar files that have been truncated.
- Code covered by automated testing: no
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Attached unit test (that will land at a later date) reproduces the crash, and doesn't crash when the fix is applied.
- Risk associated with taking this patch: low
- Explanation of risk level: The fix makes it so we also catch the SIGBUS signal when the mMap pointer is null. This happens when accessing memory for an inner JAR file (nested in another one).
With the crash mitigated, we can also remove the CrashWithInfo call which was added to debug why we still crash, even though we had a SIGBUS handler. - String changes made/needed: None
- Is Android affected?: yes
| Assignee | ||
Comment 45•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D282765
Comment 46•5 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined: Crashes when accessing mmapped memory belonging to nested jar files that have been truncated.
- Code covered by automated testing: no
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Attached unit test (that will land at a later date) reproduces the crash, and doesn't crash when the fix is applied.
- Risk associated with taking this patch: low
- Explanation of risk level: The fix makes it so we also catch the SIGBUS signal when the mMap pointer is null. This happens when accessing memory for an inner JAR file (nested in another one).
With the crash mitigated, we can also remove the CrashWithInfo call which was added to debug why we still crash, even though we had a SIGBUS handler. - String changes made/needed: None
- Is Android affected?: yes
| Assignee | ||
Comment 47•5 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D282765
Updated•5 months ago
|
Updated•5 months ago
|
Comment 48•5 months ago
|
||
| uplift | ||
Updated•5 months ago
|
Updated•5 months ago
|
Comment 49•5 months ago
|
||
| uplift | ||
Updated•5 months ago
|
Updated•5 months ago
|
Comment 50•5 months ago
|
||
sec-high is overstating the risk: this is almost entirely a start-up crash, and we only use the jar: protocol with our own files (or web extensions that we have signed). Lowering to sec-moderate
Updated•5 months ago
|
Updated•5 months ago
|
Comment 51•5 months ago
|
||
Couldn't this be an XPI file the user navigates to, Dan?
Comment 52•5 months ago
|
||
navigating to a .XPI would trigger an install which does not do any nested zips. Once an add-on is installed I don't know if there are any features that it could use that would open a nested zip file inside. Maybe? but requiring installing a malicious extension to trigger also lowers the priority to sec-moderate.
Comment 53•3 months ago
|
||
2 months ago, dveditz placed a reminder on the bug using the whiteboard tag [reminder-test 2026-04-07] .
valentin, please refer to the original comment to better understand the reason for the reminder.
Comment 55•3 months ago
|
||
Comment 56•3 months ago
|
||
Updated•2 months ago
|
Description
•