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 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.
`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.