Repository navigation
fix: upgrade adm-zip 0.4.7 -> 0.6.1 to close Zip Slip in /import - #1131
Open
Shrinandan-N wants to merge 1 commit into
Open
Shrinandan-N wants to merge 1 commit into
Shrinandan-N wants to merge 1 commit into
Conversation
…K-JS-ADMZIP-1065796) Co-Authored-By: nandu.narayanan <nandu.narayanan@cognition.ai>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /importpasses user-uploaded zips toAdmZip(buf).extractAllTo("/tmp/extracted_files", true)(routes/index.js:255-257). adm-zip@0.4.7 does not sanitize entry names, so an entry like../../usr/src/goof/public/about.htmlis written outside the target directory (Zip Slip, SNYK-JS-ADMZIP-1065796 / CWE-22).This PR pins
adm-zipto0.6.1inpackage.jsonandpackage-lock.json. No app code changes.Why 0.6.1 and not 0.4.11? 0.4.11 fixes the Zip Slip bug, but
npm auditstill reports 7 adm-zip advisories against it (memory-allocation DoS, decompression-bomb bypass, SUID bits kept on extract, duplicate-entry confusion, etc.). Every 0.5.x release, including 0.5.18, is also still flagged, and 0.5.9 and later add a symlink-follow overwrite advisory. 0.6.1 is the first version with no npm audit advisories. The API the route uses,AdmZip(buffer)called withoutnewandextractAllTo(path, overwrite), is the same in 0.6.1. Itsenginesfield isnode >=14, and the Dockerfile usesnode:18.13.0.Verification
Both runs used the same
node:18.13.0container withmongo:3, running the app as root the way the Dockerfile does. Each uploadedexploits/zip-slip/my_backup.zipand thenexploits/zip-slip/malicious_backup.zipthroughPOST /import:/tmp/extracted_files/backup.txtwritten/tmp/extracted_files/backup.txtwritten/usr/src/goof/public/about.htmloverwritten ("HAHAHA GOTCHA!")about.htmlunchanged (same md5). The entry lands inside the target dir as/tmp/extracted_files/usr/src/goof/public/about.htmlnpm testrunssnyk test, which needs Snyk auth that isn't set up here, so it was not run.Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/8f06331b317a44d0b3a7879791d9eca1
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/8f06331b317a44d0b3a7879791d9eca1?variant=devin
Requested by: @Shrinandan-N
Devin Review