CVE Professor
/
All CVEs
CVE-2026-140236

CVE-2026-140236 — Tar — CWE-436

HIGH CVSS 7.2 ⚡ EPSS 0.7% GitHub

### Summary The GHSA-vmf3 fix (7.5.16, commit 21a8220) stopped `Header.decode` from applying extended-header values to non-file blocks. `ReadEntry`, however, still copies the PAX `size` onto meta entries (GNU long-name/long-link and PAX headers), and the parser uses that value to decide how many bytes belong to the meta entry. node-tar can therefore frame an archive differently from other tar implementations. Three related places in the same code take sizes or precedence from inconsistent sources. ### Details | # | Issue | Location | Default options | |---|---|---|---| | VULN-001 | `ReadEntry` applies `ex`/`gex` `size` to meta entries, and the parser uses it to frame the meta body. This is what GHSA-vmf3 meant to prevent, through a different code path | `src/read-entry.ts:105-110` → `src/parse.ts:241,246` | Yes (`x`, `t`, `Parser`, `Unpack`, `UnpackSync`) | | VULN-004 | `maxMetaEntrySize` is checked against the PAX-overridden `entry.size`, but the meta buffer accumulates `header.size` bytes, so the limit can be exceeded | `src/parse.ts:241` (check) vs `:248` (accumulation) | Yes | | VULN-005 | `ReadEntry` applies the global header after the local one, so global values override local ones (the reverse of PAX semantics), and it applies a global `linkpath`, which `Header` excludes. Commit af04392 fixed this order in `Header` only | `src/read-entry.ts:105-110`, `:145` | Yes | | VULN-003 | When re-packing (`c`/`r`/`u` with `@archive`, or `Pack.add(ReadEntry)`), the written h

### Summary The GHSA-vmf3 fix (7.5.16, commit 21a8220) stopped `Header.decode` from applying extended-header values to non-file blocks. `ReadEntry`, however, still copies the PAX `size` onto meta entries (GNU long-name/long-link and PAX headers), and the parser uses that value to decide how many bytes belong to the meta entry. node-tar can therefore frame an archive differently from other tar implementations. Three related places in the same code take sizes or precedence from inconsistent sources. ### Details | # | Issue | Location | Default options | |---|---|---|---| | VULN-001 | `ReadEntry` applies `ex`/`gex` `size` to meta entries, and the parser uses it to frame the meta body. This is what GHSA-vmf3 meant to prevent, through a different code path | `src/read-entry.ts:105-110` → `src/parse.ts:241,246` | Yes (`x`, `t`, `Parser`, `Unpack`, `UnpackSync`) | | VULN-004 | `maxMetaEntrySize` is checked against the PAX-overridden `entry.size`, but the meta buffer accumulates `header.size` bytes, so the limit can be exceeded | `src/parse.ts:241` (check) vs `:248` (accumulation) | Yes | | VULN-005 | `ReadEntry` applies the global header after the local one, so global values override local ones (the reverse of PAX semantics), and it applies a global `linkpath`, which `Header` excludes. Commit af04392 fixed this order in `Header` only | `src/read-entry.ts:105-110`, `:145` | Yes | | VULN-003 | When re-packing (`c`/`r`/`u` with `@archive`, or `Pack.add(ReadEntry)`), the written h

CVSS v4.0 Vector Metrics
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N
Attack Vector Network AV:N
Attack Complexity Low AC:L
Attack Reqs. None AT:N
Privileges Req. None PR:N
User Interaction Passive UI:P
Vuln. Conf. Low VC:L
Vuln. Integrity High VI:H
Vuln. Avail. Low VA:L
Subseq. Conf. None SC:N
Subseq. Integ. None SI:N
Subseq. Avail. None SA:N
EPSS — Exploit Prediction Scoring System
0.7%
30-day probability
In the 54. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

CVE-2026-140236 is a Path Traversal / Archive Manipulation vulnerability (CWE-436: Import of Untrusted Code into Software) in the node-tar library, specifically affecting versions prior to 8.0.0.

The core technical flaw lies in the inconsistent handling of PAX (POSIX.1-2001) extended headers versus GNU tar headers when reading archive entries. Specifically:

1. Metadata Framing Inconsistency: The ReadEntry class incorrectly applies PAX size values to entries that are identified as GNU or PAX metadata entries. This causes node-tar to calculate the length of the archive body differently than standard tar implementations (like GNU tar or Python's tarfile).
2. Bypass of maxMetaEntrySize: Due to the framing mismatch, an attacker can craft an archive where the declared metadata size is small (passing the maxMetaEntrySize check), but the actual bytes consumed from the stream are larger, or vice versa. This desynchronization allows the parser to misinterpret the boundary between the metadata header and the actual file data.
3. PAX Precedence Reversal: The vulnerability allows for a reversal of local-versus-global PAX precedence. In standard tar, local PAX headers override global ones. This flaw allows an attacker to manipulate which size or path value is applied, potentially forcing the library to write data to an unintended location or to create additional, unexpected members in the output archive.
4. Output Archive Injection: When using the repacking feature (Pack.add(ReadEntry)), the mismatch between the declared header size and the copied body bytes can result in "extra" bytes being interpreted as new archive members. This can lead to the creation of files outside the intended extraction directory (path traversal) or the injection of malicious files into a generated archive.

Critical Distinction: This vulnerability does not affect ordinary tar creation from filesystem inputs. It specifically requires the archive-file input repacking feature or the use of Pack.add(ReadEntry) with a maliciously crafted input archive.

⚡ Attack Chain

1. Discovery & Reconnaissance

  • Target Identification: The attacker identifies a Node.js application that uses node-tar for processing user-uploaded archives (e.g., a plugin installer, a backup restoration service, or a CI/CD pipeline that unpacks artifacts).
  • Version Fingerprinting:
  • * Check package.json or package-lock.json if exposed (e.g., via a public repository or misconfigured static hosting). * Use tools like npm audit if the application exposes its dependency tree. * Behavioral testing: Upload a benign tar file with specific PAX headers and observe error messages or processing delays that might indicate version-specific parsing behavior.
  • Attack Surface Validation: Confirm that the application uses the repacking or streaming read/write functionality of node-tar (e.g., tar.x() with readable streams or tar.c() with Pack.add).
  • 2. Exploitation

    The attacker crafts a malicious tar archive that exploits the PAX/GNU header framing inconsistency.

    Illustrative PoC Concept (Node.js):
    Note: The following code is an illustrative example of how an attacker might construct the malicious payload. The exact byte-level manipulation depends on the specific version of node-tar and the implementation details of the PAX header parsing.

    const tar = require('tar');
    const fs = require('fs');
    const path = require('path');
    
    // Step 1: Create a malicious tar file
    // The goal is to create a tar entry where the PAX header declares a size 
    // that causes the parser to misframe the subsequent data.
    
    const maliciousEntry = {
      type: 'File',
      name: '../../etc/cron.d/malicious', // Path traversal target
      mode: 0o755,
      uid: 0,
      gid: 0,
      size: 100, // Declared size
      // PAX headers are used to override or extend metadata
      pax: {
        'size': '1000' // Mismatched or manipulated PAX size
      }
    };
    
    // In a real exploit, the attacker would manually construct the tar bytes
    // to ensure the PAX header length calculation in node-tar < 8.0.0 
    // results in a misalignment. This often involves:
    // 1. A PAX header that claims a certain length.
    // 2. Actual data that is shorter/longer, causing the next header 
    //    to be read from the wrong offset.
    // 3. This misalignment can cause the 'name' field of the next entry 
    //    to be interpreted as part of the data, or vice versa, allowing 
    //    path traversal or file injection.
    
    // For demonstration, we assume the attacker has crafted a binary blob 
    // 'malicious.tar' that triggers the flaw.
    // const maliciousTarBuffer = fs.readFileSync('./malicious.tar');
    
    // Step 2: Simulate the vulnerable application's behavior
    // The application likely does something like:
    // tar.x({
    //   file: 'malicious.tar',
    //   cwd: '/tmp/safe_dir',
    //   maxMetaEntrySize: 1024 // This check is bypassed due to framing error
    // });
    
    // OR, for output archive injection:
    // const pack = new tar.Pack();
    // const readEntry = tar.ReadEntry.from(maliciousTarBuffer);
    // pack.add(readEntry); // This triggers the repacking flaw
    // pack.pipe(fs.createWriteStream('/tmp/output.tar'));

    Key Exploitation Mechanics:
    1. Crafting the Archive: The attacker creates a tar file with a PAX extended header. The PAX header contains a size field that is inconsistent with the actual data block size or the GNU header size.
    2. Triggering the Flaw: When node-tar reads this entry, it applies the PAX size to the metadata entry. This causes the internal state machine to miscalculate the end of the current entry.
    3. Bypassing maxMetaEntrySize: The check for maxMetaEntrySize is performed on the declared size, not the actual bytes consumed. Due to the framing error, the actual bytes consumed can exceed the limit without triggering the check.
    4. Path Traversal/Injection: The misframing allows the parser to interpret subsequent bytes as a new header. If the attacker controls the content of these bytes, they can define a new entry with a path like ../../etc/cron.d/malicious or inject a new file into the output archive.

    3. Post-Exploitation

  • Remote Code Execution (RCE): If the path traversal allows writing to a location that is executed by the system (e.g., /etc/cron.d/, /var/www/html/, or a Node.js require path), the attacker can achieve RCE.
  • Data Exfiltration: If the vulnerability allows reading files outside the intended directory, the attacker can exfiltrate sensitive data (e.g., /etc/passwd, .env files).
  • Persistence: The attacker can install a backdoor (e.g., a malicious cron job or a webshell) to maintain access.
  • 🌍 Real World Impact

    Based on the CVSS:4.0 vector CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N:

  • Attack Vector (AV:N): Exploitable over the network.
  • Attack Complexity (AC:L): Low complexity; no special conditions required.
  • Privileges Required (PR:N): No authentication required.
  • User Interaction (UI:P): Requires user interaction (e.g., a user must upload the malicious archive or trigger the processing of a malicious artifact).
  • Confidentiality Impact (VC:L): Low. Some data may be exposed, but not all.
  • Integrity Impact (VI:H): High. The attacker can modify or create files, potentially leading to RCE.
  • Availability Impact (VA:L): Low. The application may crash or become unstable, but not necessarily fully unavailable.
  • Scope (S:X): No scope change. The vulnerable component and the impacted component are the same.
  • Practical Consequences:

  • CI/CD Pipelines: If a build system unpacks user-submitted artifacts using node-tar, an attacker can inject malicious code into the build process, leading to supply chain attacks.

  • Web Applications: If a web app allows users to upload tar archives (e.g., for plugin installation or data import), an attacker can achieve RCE on the server.

  • Backup Systems: If a backup restoration tool uses node-tar to unpack archives, an attacker can corrupt the backup or inject malicious files during restoration.
  • 🛡️ Remediation & Mitigation

    1. Upgrade

  • Affected Versions: node-tar < 8.0.0
  • Fixed Version: node-tar 8.0.0
  • Action: Immediately upgrade node-tar to version 8.0.0 or later.
  • npm install [email protected]

    2. Workarounds

  • Disable Repacking/Streaming: If upgrading is not immediately possible, avoid using the Pack.add(ReadEntry) or streaming extraction features with untrusted input. Use only the standard tar.x() with a trusted, pre-validated archive.
  • Input Validation: Validate the structure of incoming tar archives before processing. Use a separate, trusted library to parse the archive and verify that all paths are within the expected directory and that PAX headers are consistent.
  • Sandboxing: Run the Node.js process in a sandboxed environment (e.g., Docker container) with minimal privileges and a read-only filesystem, except for the intended extraction directory.
  • 3. Detection

  • Log Analysis: Look for unusual file creation or modification events in directories outside the expected extraction path.
  • * Example: auditd logs showing writes to /etc/cron.d/ or /var/www/html/ by the Node.js process.
  • Network Traffic: Monitor for unexpected outbound connections from the Node.js process, which could indicate data exfiltration or command-and-control (C2) communication.
  • File Integrity Monitoring (FIM): Use tools like AIDE or Tripwire to detect unauthorized changes to critical system files.
  • 4. WAF/ModSecurity Rules

  • Note: WAFs are not effective against this type of vulnerability, as it is a logic flaw in the library's parsing of binary data. However, you can block requests that contain tar archives if the application does not require them.
  • # Example ModSecurity rule to block tar uploads (illustrative)
        SecRule REQUEST_HEADERS:Content-Type "tar" \
            "id:100001,phase:2,deny,status:403,msg:'Blocked tar upload'"

    ⚠️ Urgency

  • CVSS Score: 7.2 (HIGH)
  • CISA KEV: No
  • Exploit Complexity: Low
  • Patching Priority: High
While this vulnerability is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, its high CVSS score and the potential for Remote Code Execution (RCE) make it a critical risk. Any application that processes untrusted tar archives using node-tar < 8.0.0 should be patched immediately. The requirement for user interaction (UI:P) slightly reduces the urgency compared to fully unauthenticated RCE vulnerabilities, but it is still a significant risk, especially in environments where users are expected to upload archives (e.g., CI/CD, plugin systems).

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)
CVSS Score
7.2 / 10 · CVSS HIGH
Weakness Types (CWE)
CWE-436
Affected Products (1)
tar
References & Advisories (4)
Related CVEs
9.8
CVE-2026-145055
PraisonAI pip praisonai before 4.8.0, praisonaiagents and npm praisonai before 1.8.0, and praisonai-bot, prais
9.0
CVE-2026-126111
Missing secure processing in the XSLT transformer of the Velocity $xslttool view tool in dotCMS allows a back-
8.8
CVE-2026-77471
shell-chain is a PQVM-native, post-quantum blockchain. Prior to version 0.27.1, the finality vote aggregation
8.7
CVE-2026-137408
In Eclipse Yasson versions 1.0 through 1.0.11, 2.0 through 2.0.4, and 3.0 through 3.0.6, the deserializers for
9.6
CVE-2026-145025
Grav API plugin before 1.1.21 validates the client-supplied admin_base_url or Origin header with PHP parse_url
8.6
CVE-2026-144962
Nginx UI from 2.4.1 before 2.9.2 contains a directive denylist bypass in internal/config/validation.go that al
8.2
CVE-2026-145366
### Summary A URI SAN is a context-specific, primitive GeneralName with tag number 6 (identifier octet `0x86`