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 src/read-entry.ts, which fails to filter linkpath when applying PAX Global Extended Header (g-type) fields to parsed entries. A tar archive containing a Global Extended Header with a linkpath field causes that attacker-controlled value to be injected into every subsequent entry returned by tar.Parser, including plain File and Directory entries, with no warning raised even under strict: true. Applications that consume tar.Parser or tar.list() directly and use entry.linkpath to build filesystem paths or create symlinks can be made to read or write files outside the intended directory.
Note: This is only exploitable in applications that use tar.Parser or tar.list() directly and act on entry.linkpath without revalidating it; tar.x() and tar.extract() are not affected because the Unpack layer independently rejects an escaping linkpath.