Skip to content

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.

REPRO-2026-00064 tar · npm Jan 17, 2026 .txt
Severity
HIGH
Reproduced in
6m 8s
Tool calls
102
Spend
$0.79
01 · Overview

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).

02 · Severity & CVSS

GHSA-8qq5-rm4j-mr97 Severity

GHSA-8qq5-rm4j-mr97 is rated high severity.

HIGH threat level

High — serious impact or readily exploitable. Prioritize remediation.

How to Reproduce GHSA-8qq5-rm4j-mr97

$ pruva-verify REPRO-2026-00064
or curl -O https://pruva.dev/api/v1/reproductions/REPRO-2026-00064/artifacts/reproduction_steps.sh && chmod +x reproduction_steps.sh && ./reproduction_steps.sh
Run in a VM or disposable container. This exploits a real vulnerability.
06 · Proof of Reproduction

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 306 events · 102 tool calls · 6 min
6 minDuration
102Tool calls
98Reasoning steps
306Events
1Dead-ends
Agent activity over 6 min
Support
10
Repro
292
0:0006:08

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-tar hardlink 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

  1. Run repro/reproduction_steps.sh.
  2. Script installs Node dependencies (including node-tar@7.5.2), crafts a malicious TAR with a hardlink pointing to secret.txt outside the extraction root, extracts it with tar.x({preservePaths:false}), writes EXPLOIT into out/payload, and finally reads secret.txt.
  3. Reproduction succeeds when the script reports secret.txt now contains: EXPLOIT and exits 0.

Evidence

  • Logs: logs/repro_20260117075559.log, logs/repro_20260117075603.log
  • Key excerpt: secret.txt now contains: EXPLOIT followed by Reproduction 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/SymbolicLink entries 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.

Event 1/40
0:000:45
0:00
session startedgpt-5.1-codex · ghsa-8qq5-rm4j-mr97 · ghsa-8qq
0:13
0:13
extract_facts
no facts extracted
0:16
0:16
extract_facts
no facts extracted
0:16
error

Unknown error

0:20
0:20
0:20
supportrepro
0:29
0:29
0:29
0:31
0:31
0:33
0:33
0:35
0:35
0:37
0:37
0:39
0:39
0:41
0:41
0:43
0:43
0:45
0:45

Artifacts and Evidence for GHSA-8qq5-rm4j-mr97

Scripts, logs, diffs, and output captured during the reproduction.

No artifacts available

08 · How to Fix

How to Fix GHSA-8qq5-rm4j-mr97

Coming soon

Step-by-step mitigation and hardening guidance for GHSA-8qq5-rm4j-mr97 — configuration checks, workarounds where no patch exists, and how to verify you're protected — is on the way.

10 · FAQ

FAQ: GHSA-8qq5-rm4j-mr97

How does the node-tar hardlink escape attack work?

A malicious TAR archive contains a Link (hardlink) entry whose linkpath is an absolute path outside the extraction directory (e.g. /tmp/secret.txt) hardlinked to an in-root entry name (e.g. payload). When the extractor later writes to that in-root path, the write actually lands on the external hardlinked file, overwriting it with attacker-controlled content.

Which versions of node-tar are affected by GHSA-8qq5-rm4j-mr97, and where is it fixed?

Versions 7.5.2 and earlier are affected. It is fixed in 7.5.3, via a fix that adds validation to reject absolute link targets.

How severe is GHSA-8qq5-rm4j-mr97?

High severity -- attackers who control TAR input can overwrite any writable file reachable by the extracting process, which can lead to configuration tampering or code execution in build/CI pipelines that extract untrusted archives.

How can I reproduce GHSA-8qq5-rm4j-mr97?

Download the verified script from this page and run it in an isolated environment against node-tar 7.5.2. It crafts a malicious TAR archive containing a hardlink entry pointing at a file outside the extraction directory, extracts it with preservePaths false, and shows the external file being overwritten.
11 · References

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.