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 Interpretation Conflict via ReadEntry in src/read-entry.ts and related parsing logic in src/parse.ts and src/pax.ts, which apply PAX extended-header fields inconsistently. ReadEntry copies the PAX size field onto GNU long-name, long-link, and PAX meta entries, causing the parser to frame those entries differently from other tar implementations such as GNU tar, bsdtar, and Python tarfile. An attacker who supplies an archive can cause node-tar to see a different set of entries than a scanner or policy check run before extraction, allowing a file the check did not see to be extracted. Additionally, maxMetaEntrySize is checked against the PAX-overridden entry.size while the meta buffer accumulates header.size bytes, allowing the memory limit to be exceeded, and PAX records are split on newlines rather than by their length field, allowing a value containing a newline to inject a forged record.
Each finding has a self-contained test in the attached bundle (`exploit_tests/test_vuln_00N_*.cjs`). Each test runs a normal archive (control) and a crafted one (attack) against the unmodified 7.5.22 build, and records both outputs in `exploit_tests/evidence/`. All tests were run on macOS. Behaviour on Linux and Windows wasn't checked, but the affected code is platform-independent.
Note: Tests were run on macOS against the unmodified 7.5.22 build; the advisory notes the affected code is platform-independent.