TechNews
node-tar 8 fixes 20 archive flaws, including symlink escapes, but needs Node.js 22
Twenty advisories for node-tar were published on Dec 1 and 2, covering symbolic links that escape the extraction folder, forged archive headers and crashes. Version 8.0.2 or later fixes all of them, but tar 8 requires Node.js 22 or newer.
7.2 HighPatch available
- Severity
- 7.2 High
CVSS 7.2, High - Status
- Patch available
- Product
- node-tar (the tar package on npm)
Am I affected?
Check your version- Affected
- versions before 8.0.0 for 19 of the flaws, and before 8.0.2 for one memory-exhaustion flaw
- Fixed in
- 8.0.2 and later (latest 8.0.5). On the 7.x line, 7.5.24 fixes only one of the 20
What to do now:
- Update tar to 8.0.2 or later. Run npm ls tar to find every copy: it often arrives as a dependency of another package.
- tar 8 requires Node.js 22 or newer. If you still run an older Node.js, plan that upgrade now: 7.x has no fix for 19 of the 20 flaws.
- Until you can update, do not use node-tar to extract archives from untrusted sources, or extract them in an isolated container.
Twenty security advisories for node-tar, the library published on npm as tar, were released on GitHub on Dec 1 and 2. Nineteen are rated high and one medium, with CVSS 4.0 scores from 6.9 to 7.2. npm counted about 113.5 million downloads of the package in the week of Nov 24 to Nov 30.
The fixes are already out: version 8.0.0 was released on Nov 28, followed a few hours later by 8.0.2, which fixes the last of the 20. But tar 8 requires Node.js 22 or newer, and only one of the flaws was fixed on the older 7.x line.
What the flaws do
node-tar’s documentation promises that “Link and SymbolicLink entries are not allowed to target locations outside of the extraction folder”. Seven of the advisories describe ways a crafted archive breaks that promise. One uses a “..” segment that follows a symbolic link created earlier by the same archive. Another uses a backslash, which the containment check and the code that creates the link read differently on hosts other than Windows. That report confirms reading /etc/passwd with default extraction options.
Several more advisories concern PAX extended headers, the records in a tar file that carry long file names and other attributes. In the most serious case, CVE-2026-140238, a newline inside a header value lets an attacker forge an entry’s attributes, including its path, so the file is written somewhere the archive did not declare. The reporter demonstrated it end to end: “overwriting package.json inside an installed npm package and executing an injected postinstall on a real Windows machine”.
The rest are denial-of-service bugs. They include a small archive that exhausts memory or CPU, a 4-byte zstd header that crashes the process when Node.js lacks native zstd support, and extractions that hang forever. The two advisories published on the evening of Dec 2 add to that list. In one, CVE-2026-140230, a symbolic link with a very deeply nested target makes node-tar build an enormous list of paths: “A 181-byte gzip archive is sufficient to instantly kill any Node.js process attempting extraction.” The other, CVE-2026-140231, lets decompressed data pile up in memory without limit.
The Node.js 22 catch
| Version | Released | Requires | Fixes |
|---|---|---|---|
| 7.5.24 | Nov 26 | Node.js 18 or newer | 1 of the 20 flaws (CVE-2026-140242) |
| 8.0.0 | Nov 28 | Node.js 22 or newer | 18 flaws; 8.x is not affected by CVE-2026-140242 |
| 8.0.2 | Nov 28 | Node.js 22 or newer | The last one, CVE-2026-140240 |
The current release is 8.0.5, published on Dec 2. Projects that still run Node.js 18 or 20 cannot simply bump the dependency: they need a newer Node.js first.
What to do
Find every copy with npm ls tar, then update to 8.0.2 or later. The risk is highest where a program extracts archives it did not create, such as uploaded files, downloaded packages and build artifacts. If you cannot move to Node.js 22 yet, do not extract untrusted archives with node-tar until you can.
Updated Dec 3 to add two advisories published on the evening of Dec 2, CVE-2026-140230 and CVE-2026-140231. Both are fixed in 8.0.0, so the advice is unchanged.
Sources
- node-tar security advisoriesProject
- GHSA-mpg7-vg3p-wc3m: Newline injection in PAX extended-header records enables entry-attribute forgeryAdvisory
- GHSA-gvrf-jx37-rjv5: Symlink linkpath escape check is lexicalAdvisory
- GHSA-hqgx-p3r3-2cfg: SymbolicLink extraction escapes the extraction directory via a backslashAdvisory
- tar on npmnpm
- npm download counts for tarnpm
Spotted a mistake? Report an error
Related coverage
More in Tech ›TechNews
cross-spawn fixes critical command injection when Node.js apps run batch files on Windows
TechNews
Rack, Mongoose and DOMPurify flaws get CVEs this week, but the fixes have been out since November
TechNews