Improper Neutralization of Null Byte or NUL Character Affecting tar package, versions <8.0.0


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

Do your applications use this vulnerable package?

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 applications
  • Snyk IDSNYK-JS-TAR-23314548
  • published2 Dec 2026
  • disclosed2 Dec 2026
  • creditw116tjb

Introduced: 2 Dec 2026

NewCVE-2026-140234  (opens in a new tab)
CWE-158  (opens in a new tab)

How to fix?

Upgrade tar to version 8.0.0 or higher.

Overview

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 truncation in src/header.ts, src/parse.ts, and src/pax.ts when parsing ustar names, GNU long-name/long-link data, and PAX values. The regex .replace(/\0.*/, '') lacks the s flag, so . does not match \n, \r, U+2028, or U+2029. When one of these line terminators follows a NUL byte in an entry name, only the portion up to the line terminator is removed and the NUL remains in the name. During async extraction, the NUL-containing name is passed to fs, which throws an uncaught exception and crashes the process. With the strip option enabled, the surviving characters also cause node-tar's view of the name to differ from other tar implementations.

PoC

`exploit_tests/test_vuln_006_*` and `_021_`. Each runs a control and an attack against the unmodified 7.5.22 build, with output recorded in `exploit_tests/evidence/`. All were run on macOS.

Note: Tests were run against the unmodified 7.5.22 build on macOS.

CVSS Base Scores

version 4.0
version 3.1