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 Insufficient Verification of Data Authenticity via the #slurp() method in read-entry.js, which fails to filter the linkpath field when applying Global PAX Extended Header (g-type) fields to parsed entries. header.js correctly excludes linkpath from global headers with a guard clause, but read-entry.js contains no equivalent filter, so an attacker-controlled linkpath value from a Global Extended Header is injected into every subsequent tar.Parser entry - including plain File and Directory entries - with no warning raised even under strict: true. Any application that consumes tar.Parser or tar.list() directly and uses entry.linkpath to build filesystem paths or create symlinks without revalidating the value can be made to read or write files outside the intended directory via a path-traversal symlink.
Note: This is only exploitable in applications that use tar.Parser or tar.list() directly and act on entry.linkpath without bounds-checking; applications that use only tar.x() / tar.extract() are not affected because the Unpack layer's STRIPABSOLUTEPATH guard rejects an escaping linkpath at extraction time.