Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
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 Improper Neutralization of Null Byte or NUL Character via incomplete NUL-byte sanitization in src/pax.ts, src/parse.ts, and src/header.ts during asynchronous extraction. The sanitization regex /\0.*/ uses a bare dot that does not match line terminators (\n, \r), so a NUL byte appearing after a line terminator in an archive-controlled path or linkpath string survives the replacement. The surviving NUL is passed to Node.js filesystem APIs (e.g., fs.lstat) inside an async continuation where no node-tar code catches the resulting TypeError [ERR_INVALID_ARG_VALUE], causing an uncaught exception that terminates the extracting process. An attacker who can supply an archive to any process that extracts it with the default asynchronous tar.x / tar.extract API can crash that process with a single small archive, bypassing even correctly structured try/await/catch consumer error handling because the throw occurs outside the returned promise and outside the stream error event.
Note: This is only exploitable via the asynchronous extraction API (tar.x / tar.extract); synchronous extraction (UnpackSync) and listing (tar.t) are not affected.
See the attached PoC zip. Summary:
./deployment/deploy.sh # stages a sandbox with pinned tar@7.5.22
./poc/poc.sh # builds six archives and runs the assertions
poc.sh prints one PASS line per assertion and ends with RESULT: 8 passed, 0 failed on the affected version. It includes a benign control, the original advisory payload (clean since 7.5.17), the CR bypass variant, two raw-header variants (CR and LF), a GNU L variant, and negative controls proving that sync extraction and listing do not crash. Full executed output is in the zip's README.md.
A minimal single-archive reproduction: build a tar whose first entry is an x extended header containing the record 15 path=p\0q\r\0r (valid length prefix), followed by a normal file header, then run tar.extract({ cwd }) asynchronously. On tar@7.5.22 the process dies with ERR_INVALID_ARG_VALUE naming the path <cwd>/p\r\x00r.
Note: The PoC targets tar@7.5.22 and is run in a sandbox staged by a deployment script included in the attached zip.