{"schema":"threatline.record/2","record":{"id":"GHSA-p634-w6r4-rjp2","aliases":["CVE-2026-114104","GHSA-p634-w6r4-rjp2"],"summary":"adm-zip: Duplicate ZIP entry names: getEntry() and extractAllTo() resolve to different content","details":"### Summary\n\nA ZIP file can contain two entries with the identical name. adm-zip keeps both in its internal entry list, but its name-lookup table only retains the last one written. `getEntry(name)` and `extractAllTo()` walk these two different internal structures, so they can each resolve a duplicate name to a *different* entry. An application that validates a named entry's contents via `getEntry()` before trusting an archive, then extracts the whole archive, can end up approving one file's content while a different file's bytes are what actually land on disk under that name.\n\n### Details\n- `zipFile.js:58-83` retains both entries in `entryList` but overwrites `entryTable[name]` with only the last one written.\n- `adm-zip.js:83-95,658-663` uses `entryTable` for `getEntry()` lookups — returns the *last* duplicate.\n- `adm-zip.js:769-914` iterates `entryList` for extraction — writes the *first* duplicate (sync, default overwrite policy).\n\n\n### PoC\n```js\nconst AdmZip = require('adm-zip');\nconst z = new AdmZip({ noSort: true });\nz.addFile('a.txt', Buffer.from('FIRST'));\nz.addFile('b.txt', Buffer.from('SECOND'));\nconst raw = Buffer.from(z.toBuffer());\n// rename the a.txt entry to b.txt directly in the raw bytes\nfor (let at = raw.indexOf('a.txt'); at >= 0; at = raw.indexOf('a.txt', at + 5)) {\n  raw.write('b.txt', at);\n}\nconst parsed = new AdmZip(raw, { noSort: true });\nconst validated = parsed.getEntry('b.txt').getData().toString();\nparsed.extractAllTo(outDir, false);\n// validated === \"SECOND\", but the file written to disk === \"FIRST\"\n```\n\nReproduced on the pinned commit (`2b4d84087d45344643e0183756e19191d52815cc`)\n\n### Impact\nAn application that checks a named entry's content before trusting an untrusted ZIP, then extracts it, can be made to approve different bytes than what actually gets written to disk — the classic check/use split that this kind of validate-then-extract pattern relies on.","categories":["Libraries & packages"],"product":"adm-zip","vendor":"","ecosystem":"npm","affected_ranges":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-p634-w6r4-rjp2","source_modified_at":"2026-09-29T23:11:04Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"adm-zip"},"range":"<= 0.6.0"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-p634-w6r4-rjp2","source_modified_at":"2026-10-21T10:57:22.783519393Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"adm-zip","ecosystem":"npm","purl":"pkg:npm/adm-zip"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.6.1"}]}],"versions":[]}],"fixed_versions":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-p634-w6r4-rjp2","source_modified_at":"2026-09-29T23:11:04Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"adm-zip"},"version":"0.6.1"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-p634-w6r4-rjp2","source_modified_at":"2026-10-21T10:57:22.783519393Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"adm-zip","ecosystem":"npm","purl":"pkg:npm/adm-zip"},"version":"0.6.1"}],"cvss":5.9,"severity":"Medium","kev":{"listed":false},"epss":{"probability":null,"percentile":null,"score_date":null},"published_at":"2026-09-29T23:11:01Z","modified_at":"2026-10-21T10:57:22.783519393Z","provenance":[{"source":"GitHub Advisory Database","url":"https://github.com/advisories/GHSA-p634-w6r4-rjp2","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-09-29T23:11:04Z"},{"source":"OSV","url":"https://osv.dev/vulnerability/GHSA-p634-w6r4-rjp2","fetched_at":"2026-10-23T18:45:31.882637Z","source_modified_at":"2026-10-21T10:57:22.783519393Z"}],"sources":["GitHub Advisory Database","OSV"],"references":[{"url":"https://github.com/cthackers/adm-zip/security/advisories/GHSA-p634-w6r4-rjp2","source":"GitHub Advisory Database"},{"url":"https://github.com/cthackers/adm-zip/commit/05101d47b3b983b705cc3e66fc34366118ba7b99","source":"GitHub Advisory Database"},{"url":"https://github.com/cthackers/adm-zip/releases/tag/v0.6.1","source":"GitHub Advisory Database"},{"url":"https://github.com/advisories/GHSA-p634-w6r4-rjp2","source":"GitHub Advisory Database"}],"locations":[],"motoko_assessment":{"status":"requires_architecture_review","automatic_remediation":false},"classification":{"method":"product-first software-layer rules","rules_version":"2.1","matched_on":"ecosystem","confidence":"heuristic","reviewed":false},"change_timestamp":"2026-10-21T10:57:22.783519393Z","content_hash":"1e8b1033b043703680ba8e91e63d53a07ca5d27ab8cfdb73bc1750807599f2b7"}}
