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 applicationsLearn about Allocation of Resources Without Limits or Throttling vulnerabilities in an interactive lesson.
Start learningUpgrade 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 Allocation of Resources Without Limits or Throttling via the PathReservations.getDirs helper in src/path-reservations.ts, which rebuilds a growing path prefix once per segment at O(N^2) time and memory cost. When the asynchronous Unpack extractor processes a symlink or hardlink entry, it pushes entry.linkpath into reserve(), which maps it through getDirs with no depth bound - the existing maxDepth guard is applied only to entry.path, never to entry.linkpath. An attacker who supplies an archive containing a single symlink entry with a deeply nested relative linkpath (e.g. a/a/.../a) causes the quadratic heap growth to exhaust the V8 heap and abort the Node.js process with an uncatchable fatal out-of-memory error (exit code 134).
Note: This is only exploitable on non-Windows hosts using the default asynchronous extraction API (tar.extract / Unpack); synchronous extraction (sync: true) and the Windows reservation path are not affected.