{"id":"CVE-2024-12905","aliases":["CVE-2024-12905","GHSA-pq67-2wwv-3xjx"],"related":[],"kind":"vulnerability","state":"published","title":"tar-fs Vulnerable to Link Following and Path Traversal via Extracting a Crafted tar File","summary":"An Improper Link Resolution Before File Access (\"Link Following\") and Improper Limitation of a Pathname to a Restricted Directory (\"Path Traversal\"). This vulnerability occurs when extracting a maliciously crafted tar file, which can result in unauthorized file writes or overwrites outside the intended extraction directory. The issue is associated with index.js in the tar-fs package.\n\nThis issue affects tar-fs: from 0.0.0 before 1.16.4, from 2.0.0 before 2.1.2, from 3.0.0 before 3.0.8.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"An Improper Link Resolution Before File Access (\"Link Following\") and Improper Limitation of a Pathname to a Restricted Directory (\"Path Traversal\"). This vulnerability occurs when extracting a maliciously crafted tar file, which can result in unauthorized file writes or overwrites outside the intended extraction directory. The issue is associated with index.js in the tar-fs package.\n\nThis issue affects tar-fs: from 0.0.0 before 1.16.4, from 2.0.0 before 2.1.2, from 3.0.0 before 3.0.8.","source":"cvelist"},{"lang":"en","text":"An Improper Link Resolution Before File Access (\"Link Following\") and Improper Limitation of a Pathname to a Restricted Directory (\"Path Traversal\"). This vulnerability occurs when extracting a maliciously crafted tar file, which can result in unauthorized file writes or overwrites outside the intended extraction directory. The issue is associated with index.js in the tar-fs package.\n\nThis issue affects tar-fs: from 0.0.0 before 1.16.4, from 2.0.0 before 2.1.2, from 3.0.0 before 3.0.7.\n\n### PoC\n```javascript\n// Create a writable stream to extract the tar content\nconst extractStream = tarfs.extract('/', {\n    // We can ignore the file type checks to allow the extraction of the malicious file\n    ignore: (name) => false,\n});\n\n// Create a tar stream\nconst tarStream = tarfs.pack().on('error', (err) => {\n    throw err;\n});\n\n// Append the malicious entry to the tar stream\ntarStream.entry({ name: '/flag.txt', mode: 0o644 }, Buffer.from('This is a flag!'));\n\n// Finalize the tar stream\ntarStream.finalize();\n\n// Pipe the tar stream into the extract stream\ntarStream.pipe(extractStream);\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Resolución incorrecta de enlaces antes del acceso a archivos (\"Link Following\") y limitación incorrecta de una ruta a un directorio restringido (\"Path Traversal\"). Esta vulnerabilidad se produce al extraer un archivo tar manipulado con fines maliciosos, lo que puede provocar escrituras o sobrescrituras no autorizadas de archivos fuera del directorio de extracción previsto. El problema está asociado con index.js en el paquete tar-fs. Este problema afecta a tar-fs: desde la versión 0.0.0 hasta la 1.16.4, desde la versión 2.0.0 hasta la 2.1.2, desde la versión 3.0.0 hasta la 3.0.8.","source":"nvd"}],"published":"2025-03-27T16:25:34.410Z","modified":"2026-09-10T03:50:23.170Z","severity":{"scorer":"seal","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"seal","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-22","CWE-59"],"affected":[{"ranges":[{"type":"semver","introduced":"0.0.0","fixed":"1.16.4","status":"affected"},{"type":"semver","introduced":"2.0.0","fixed":"2.1.2","status":"affected"},{"type":"semver","introduced":"3.0.0","fixed":"3.0.8","status":"affected"}],"package":"tar-fs","repo":"https://github.com/mafintosh/tar-fs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.16.4"}],"ecosystem":"npm","package":"tar-fs","purl":"pkg:npm/tar-fs","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.0.0","status":"affected","fixed":"2.1.2"}],"ecosystem":"npm","package":"tar-fs","purl":"pkg:npm/tar-fs","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"3.0.0","status":"affected","fixed":"3.0.7"}],"ecosystem":"npm","package":"tar-fs","purl":"pkg:npm/tar-fs","source":"ghsa"}],"references":[{"url":"https://github.com/mafintosh/tar-fs/commit/a1dd7e7c7f4b4a8bd2ab60f513baca573b44e2ed","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.seal.security/blog/a-link-to-the-past-uncovering-a-new-vulnerability-in-tar-fs","tags":["technical-description","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/06/msg00012.html","tags":["web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-12905","tags":["advisory"],"sources":["ghsa"]},{"url":"https://arxiv.org/abs/2506.04962","tags":["web"],"sources":["ghsa"]},{"url":"https://arxiv.org/pdf/2506.04962","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/mafintosh/tar-fs","tags":["package"],"sources":["ghsa"]}],"credits":["@bnbdr"],"assigner":"seal","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2025-03-27T18:21:53.061Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-12905","url":"https://www.cve.org/CVERecord?id=CVE-2024-12905","licence":"CVE Terms of Use","modified":"2025-11-03T19:29:11.810Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-pq67-2wwv-3xjx","url":"https://github.com/advisories/GHSA-pq67-2wwv-3xjx","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:23.170Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-12905","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-12905","licence":"Public domain","modified":"2026-06-17T07:00:44.367Z"}],"updatedAt":"2026-11-25T22:58:52.450Z","epss":{"score":0.02299,"percentile":0.83773,"date":"2026-12-01T12:00:22.000Z"}}