# node-tar: Archive framing differential from PAX size still being applied to GNU/PAX meta entries via ReadEntry and related size/precedence inconsistencies

node-tar's ReadEntry applies PAX size to GNU/PAX meta entries, letting crafted archives be framed differently than other tar tools, bypassing pre-extraction scanners.

- Payout: Research
- Severity: high
- Program: node-tar
- Found by: w116tjb
- Disclosed: 2026-12-02
- CVE: CVE-2026-140236
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-qv2w-fc3h-pm27
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-qv2w-fc3h-pm27
- Tags: area:oss domain:oss impact:dos impact:integrity kind:research platform:ghsa sev:high tech:nodejs technique:incomplete-fix technique:parser-differential technique:source-review vuln:misconfiguration

**Target:** npm tar archive parser (ReadEntry/parse.ts)
**Root cause:** ReadEntry copies PAX ex/gex size onto meta entries (GNU long-name/long-link and PAX headers) and the parser uses it to frame the meta body, so node-tar frames archives differently from other tar implementations. Related inconsistencies: maxMetaEntrySize checked against overridden size but buffer accumulates header.size; global header applied after local (reversing PAX precedence); re-pack writes entry.size but body from block count.
**Steps:**
1. Craft a tar archive with a PAX extended header whose size field differs from the actual meta body length.
2. Feed to node-tar 7.5.22 (Parser/Unpack/UnpackSync) and to another tar tool; observe divergent entry framing.
3. Run a scanner/policy check on the archive, then extract with node-tar: a file the scanner did not see is extracted.
4. For VULN-004: set PAX size small to pass maxMetaEntrySize check while header.size accumulates more bytes.
5. For VULN-003: re-pack with `c`/`r`/`u` @archive or Pack.add(ReadEntry) to inject extra entries into output.
**How found:** Reporter noticed the GHSA-vmf3 fix (commit 21a8220) only patched Header.decode, then traced ReadEntry still copying PAX size onto meta entries and the parser using it for framing; audited adjacent size/precedence sources for the same class of inconsistency.
**Exploitation:** Attacker supplies a crafted archive; a scanner or policy check run before extraction sees a different entry set than node-tar, so a hidden file is extracted. VULN-004 exceeds the meta-entry memory limit; VULN-003 propagates the inconsistency into archives node-tar produces from untrusted input.
**Escalation:** Chaining scanner bypass with extraction yields files the check never inspected; re-pack path carries the differential into downstream archives.
**Insight:** When a fix lands in one decode path, grep for parallel code paths (ReadEntry vs Header) that copy the same extended-header fields; meta-entry framing is a classic parser-differential surface where size precedence between local/global and header/body must be audited together.

