Home/Research/Post

GHSA-7c32-79xj-j3jp: node-tar: A small archive exhausts memory or CPU through path-reservation bookkeeping

  • Severity: HIGH
  • CVE: CVE-2026-140240
  • Ecosystems: npm
  • Packages: tar

### Summary

The GHSA-f5x3-32g6-xq36 fix bounded the depth (component count) of `entry.path` with `maxDepth`. The path-reservation code still computes every ancestor prefix of each reserved path, and its cost grows with the number of components multiplied by the path length. That bound doesn’t apply to `linkpath`, nor to long components within the depth limit. Reservation state and some caches are also never released for the life of an extraction.

### Details

| # | Issue | Location | Default options |
|—|—|—|—|
| VULN-002 | `linkpath` has no depth or length bound and is reserved for every entry type. `getDirs` cost is quadratic in its length, so an archive of a few hundred bytes compressed aborts the Node process | `src/path-reservations.ts:25-38`, via `src/unpack.ts:729-734` | Yes (async `x`/`Unpack`) |
| VULN-023 | Within `maxDepth`, very long components make the same `getDirs` computation exhaust memory (the depth fix bounds count, not length) | `src/path-reservations.ts:25-38`, via `src/unpack.ts:734` | Yes (async) |
| VULN-009 | `PathReservations.#reservations` entries are never deleted, so ancestor strings for every entry are kept until the `Unpack` ends | `src/path-reservations.ts:64` | Yes (async) |
| VULN-012 | The `normalizeUnicode` cache is capped by entry count (10k), not bytes, so long names make it large | `src/normalize-unicode.ts:5-35` | Yes (async) |
| VULN-024 | `filesFilter` memoises every path prefix; memory grows with depth × length. The GHSA-r2…

Source: GitHub Security Advisories · 2026-12-02