GHSA-8qq5-rm4j-mr97: Verified Repro With Script Download
GHSA-8qq5-rm4j-mr97: node-tar Arbitrary File Overwrite via Hardlink Escape
GHSA-8qq5-rm4j-mr97 is verified against tar · npm. This high reproduction includes runnable sandbox proof, artifacts, and a plain-text agent view under REPRO-2026-00064.
What Is GHSA-8qq5-rm4j-mr97?
GHSA-8qq5-rm4j-mr97 is a high-severity arbitrary file overwrite vulnerability in the node-tar library (<= 7.5.2), where hardlink and symlink entries with unsanitized linkpath values let a malicious TAR archive escape the extraction root during extraction. Pruva reproduced it (reproduction REPRO-2026-00064).
GHSA-8qq5-rm4j-mr97 Severity
GHSA-8qq5-rm4j-mr97 is rated high severity.
High — serious impact or readily exploitable. Prioritize remediation.
How to Reproduce GHSA-8qq5-rm4j-mr97
pruva-verify REPRO-2026-00064 curl -O https://pruva.dev/api/v1/reproductions/REPRO-2026-00064/artifacts/reproduction_steps.sh && chmod +x reproduction_steps.sh && ./reproduction_steps.sh Proof of Reproduction for GHSA-8qq5-rm4j-mr97
Reproduced by Pruva's autonomous agents — 102 tool calls over 6 min. Full root-cause analysis and the complete transcript are below.
How the agent worked
Root Cause and Exploit Chain for GHSA-8qq5-rm4j-mr97
Summary
node-tar ≤ 7.5.2 does not sanitize the linkpath field of Link entries when extracting with preservePaths=false. A malicious TAR can hardlink a file inside the extraction root (e.g., payload) to an absolute path outside the root (e.g., /tmp/secret.txt). When the extractor later writes to the in-root path, it actually overwrites the arbitrary external file, enabling path-escape and arbitrary file overwrite.
Impact
- Affected component:
node-tarhardlink extraction logic (unpack.ts) - Affected versions: 7.5.2 and earlier (fixed in 7.5.3)
- Risk: High. Attackers controlling TAR input can overwrite any writable file reachable by the extracting process, enabling configuration tampering or code execution in build/CI pipelines.
Root Cause
node-tar resolves hardlink targets with path.resolve(this.cwd, entry.linkpath) but never checks that the resulting path still resides under cwd. Because path.resolve returns the second operand unchanged when it is absolute, an attacker can supply an absolute linkpath. The library then creates a hardlink from the in-root entry.path to the attacker-chosen absolute file. Subsequent writes to entry.path therefore modify the external target. Fix commit (upstream): https://github.com/isaacs/node-tar/commit/340eb285b6d986e91969a1170d7fe9b0face405e adds validation to reject absolute link targets.
Reproduction Steps
- Run
repro/reproduction_steps.sh. - Script installs Node dependencies (including
node-tar@7.5.2), crafts a malicious TAR with a hardlink pointing tosecret.txtoutside the extraction root, extracts it withtar.x({preservePaths:false}), writesEXPLOITintoout/payload, and finally readssecret.txt. - Reproduction succeeds when the script reports
secret.txt now contains: EXPLOITand exits 0.
Evidence
- Logs:
logs/repro_20260117075559.log,logs/repro_20260117075603.log - Key excerpt:
secret.txt now contains: EXPLOITfollowed byReproduction successful: secret.txt overwritten via hardlink escape - Environment: Node v22.21.1, npm 10.9.4 as captured in the log prologue.
Recommendations / Next Steps
- Upgrade to
node-tar≥ 7.5.3 where absolute link targets are rejected. - When possible, reject TAR archives containing
Link/SymbolicLinkentries or perform manual validation that resolved paths stay inside the extraction root. - Add regression tests that extract crafted archives with absolute
linkpaths to ensure future sanitization.
Additional Notes
- Script is idempotent: executed twice consecutively; both runs succeeded and produced separate timestamped logs.
- Limitation: PoC demonstrates hardlink overwrite only; symlink poisoning is related but not exercised here.
GHSA-8qq5-rm4j-mr97 Reproduction Transcript
The agent's step-by-step process — every tool call, every handoff, the moment the exploit fired.
Full session Replay every step — scrub the timeline or play it back.
Unknown error
Artifacts and Evidence for GHSA-8qq5-rm4j-mr97
Scripts, logs, diffs, and output captured during the reproduction.
No artifacts available
How to Fix GHSA-8qq5-rm4j-mr97
FAQ: GHSA-8qq5-rm4j-mr97
How does the node-tar hardlink escape attack work?
Which versions of node-tar are affected by GHSA-8qq5-rm4j-mr97, and where is it fixed?
How severe is GHSA-8qq5-rm4j-mr97?
How can I reproduce GHSA-8qq5-rm4j-mr97?
References for GHSA-8qq5-rm4j-mr97
Authoritative sources for GHSA-8qq5-rm4j-mr97 — official vulnerability databases and the upstream advisory. Pruva's reproduction verifies the issue firsthand; these are the primary records to corroborate it.