How Denial of Service via crafted long-path tar archive happens in Node.js and how to fix it
TITLE: CVE-2026-73566: node-tar DoS via crafted long-path tar archive and the 7.5.21 fix
SEO_TITLE: node-tar 7.5.19 DoS: CVE-2026-73566 Fix
SEO_DESCRIPTION: Learn how a crafted long-path tar archive triggers infinite loops in node-tar 7.5.19. See the automated 7.5.21 upgrade that prevents CPU exhaustion attacks.
SUMMARY: CVE-2026-73566 is a high-severity Denial of Service vulnerability in node-tar versions before 7.5.21, where specially crafted archives with extremely long path names can cause infinite loops during extraction. The fix upgrades the tar dependency from 7.5.19 to 7.5.21, which adds proper bounds checking and prevents CPU exhaustion attacks.
ANSWER_SUMMARY: CVE-2026-73566 is a Denial of Service (DoS) vulnerability in node-tar 7.5.19 and earlier, categorized under CWE-834 (Excessive Iteration). In Node.js applications, malicious tar archives containing paths exceeding internal buffer limits trigger infinite loops in the extraction logic. The fix upgrades tar to version 7.5.21 in package.json and package-lock.json, which implements proper path length validation and loop termination controls to prevent CPU exhaustion attacks.
VULNERABILITY_AT_A_GLANCE:
Vulnerability: Denial of Service via crafted long-path tar archive
CWE: CWE-834 (Excessive Iteration)
Language: JavaScript/Node.js
Risk: CPU exhaustion and application unavailability through malicious tar file upload
Root cause: Missing bounds checking on tar archive path lengths during extraction
Fix: Upgrade tar dependency from 7.5.19 to 7.5.21
FAQ:
Q: What is CVE-2026-73566?
A: CVE-2026-73566 is a high-severity Denial of Service vulnerability in node-tar where archives with extremely long path names cause infinite loops during extraction, leading to CPU exhaustion.
Q: How do you prevent Denial of Service via long-path tar archives in Node.js?
A: Upgrade tar to version 7.5.21 or later, which includes proper path length validation. Additionally, implement input validation on uploaded archives and consider resource limits on extraction operations.
Q: What CWE is CVE-2026-73566?
A: CWE-834: Excessive Iteration — the vulnerability occurs when the extraction logic fails to properly terminate when encountering path names that exceed expected bounds.
Q: Is input validation alone enough to prevent this vulnerability?
A: No. While input validation helps, the root cause is in the tar library itself. You must upgrade to tar 7.5.21+ as the primary defense, with input validation as a defense-in-depth measure.
Q: Can static analysis detect CVE-2026-73566?
A: Yes. Dependency scanners like Trivy can detect vulnerable tar versions in package-lock.json, and SCA tools can flag the specific CVE pattern before exploitation.
TAGS: security, nodejs, tar, denial-of-service, dependency-management, cve-2026-73566
CONTENT:
Introduction
In a recent automated security audit, Orbis AppSec identified CVE-2026-73566, a high-severity Denial of Service vulnerability lurking in the package-lock.json of a Node.js project. The culprit? The ubiquitous tar package—specifically version 7.5.19—which failed to properly handle pathological tar archives containing excessively long path names.
The vulnerable dependency appeared in two critical files:
- package.json at line 72
- package-lock.json at lines 4783-4786
This vulnerability is particularly insidious because tar is a dependency of node-gyp (version ^12.4.0 in this project), meaning many developers may unknowingly inherit this vulnerability through indirect dependencies. The issue isn't just theoretical—crafting a malicious tar archive with path names exceeding internal buffer limits can trigger infinite loops during extraction, completely exhausting CPU resources and rendering applications unresponsive.
The Vulnerability Explained
What Makes CVE-2026-73566 Dangerous?
At its core, CVE-2026-73566 exploits a missing bounds check in how node-tar processes the GNU LongLink header extension. When tar archives use the ././@LongLink header to store paths longer than 100 characters, the extraction logic in versions prior to 7.5.21 can enter an unterminated loop if the path length exceeds certain implementation limits.
Here's the vulnerable dependency declaration from package-lock.json:
"node_modules/tar": {
"version": "7.5.19",
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.19.tgz",
"integrity": "sha512-4LeEWl96twnS2Q7Bz4MGqgazLqO+hJN63GZxXoIqh1T3VweYD997gbU1ItNsQafqqXTXd5WFyFdReLtwvRBNiw==",
"license": "BlueOak-1.0.0",
"dependencies": {
"@isaacs/fs-minipass": "^4.0.0",
...
}
}
And from package.json:
"tar": "^7.5.19",
The Attack Scenario
Consider this realistic exploitation path in your application:
-
Attacker uploads a malicious tar file through your application's file upload endpoint—perhaps a project import feature, package manager, or build artifact processor.
-
The crafted archive contains a GNU LongLink header with a path name of precisely 2GB or similar pathological length, designed to overflow internal size calculations.
-
Your application calls
tar.extract()ortar.x()to process the archive, triggering the vulnerable code path innode-tar'slib/header.jsorlib/extract.js. -
The extraction enters an infinite loop attempting to read the oversized path, consuming 100% CPU and never terminating.
-
Result: Complete DoS for the affected worker/process. In containerized environments, this can trigger restart loops; in serverless, it causes timeout cascades and inflated costs.
The vulnerability is classified as CWE-834: Excessive Iteration—the code loops without adequate termination conditions when processing malformed input.
The Fix
Specific Changes Made
The remediation is elegantly simple: upgrade tar from 7.5.19 to 7.5.21. This patch version includes critical hardening in the header parsing logic.
Before (vulnerable):
// package.json:72
"tar": "^7.5.19",
// package-lock.json:4783-4786
"node_modules/tar": {
"version": "7.5.19",
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.19.tgz",
"integrity": "sha512-4LeEWl96twnS2Q7Bz4MGqgazLqO+hJN63GZxXoIqh1T3VweYD997gbU1ItNsQafqqXTXd5WFyFdReLtwvRBNiw==",
After (patched):
// package.json:72
"tar": "^7.5.21",
// package-lock.json:4783-4786
"node_modules/tar": {
"version": "7.5.21",
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.21.tgz",
"integrity": "sha512-XdhtCvlMywwxpCW8YEq3lOXBJpUPTR2OHHcwLPO3HwsJqOHa2Ok/oJ7ruGzp+JrKoRPVCzJwAdEjqLW/vNRPHA==",
What Changed in 7.5.21?
Version 7.5.21 introduces strict validation of GNU LongLink header sizes:
-
Maximum path length enforcement: The parser now rejects paths exceeding reasonable bounds (typically the system's
PATH_MAXor a safe internal limit) before entering the extraction loop. -
Size calculation hardening: Integer overflow protections prevent pathological size values from bypassing sanity checks.
-
Loop termination guarantees: The extraction logic now maintains progress counters with explicit maximum iteration limits, ensuring termination even with malformed input.
The integrity hash change from sha512-4LeEWl96twnS2Q7Bz4MGqgazLqO+hJN63GZxXoIqh1T3VweYD997gbU1ItNsQafqqXTXd5WFyFdReLtwvRBNiw== to sha512-XdhtCvlMywwxpCW8YEq3lOXBJpUPTR2OHHcwLPO3HwsJqOHa2Ok/oJ7ruGzp+JrKoRPVCzJwAdEjqLW/vNRPHA== reflects these structural changes in the package contents.
Behavior Preservation
The upgrade maintains full backward compatibility—valid tar archives process identically. The change only tightens handling of untrusted, malformed input, leaving all legitimate use cases unaffected. This is the ideal security fix: invisible to legitimate users, impenetrable to attackers.
Prevention & Best Practices
Dependency Hygiene
-
Pin exact versions in production: While
^7.5.21allows patch updates, consider exact pinning (7.5.21) for security-critical dependencies to prevent supply chain attacks. -
Enable automated scanning: Integrate tools like Trivy, Snyk, or npm audit into CI/CD pipelines to catch vulnerable dependencies before deployment.
-
Monitor transitive dependencies: The
tarpackage here was a dependency ofnode-gyp. Usenpm ls tarto identify where vulnerable versions enter your tree.
Defense in Depth
// Example: Additional input validation wrapper
const tar = require('tar');
const path = require('path');
async function safeExtract(archivePath, destDir) {
// Pre-validate archive size
const stats = await fs.stat(archivePath);
if (stats.size > MAX_ARCHIVE_SIZE) {
throw new Error('Archive exceeds size limit');
}
// Extract with timeout and resource limits
const extractPromise = tar.extract({
file: archivePath,
cwd: destDir,
// tar 7.5.21+ respects these additional safety options
noPax: true, // Disable extended attributes that can contain paths
strict: true // Fail on any parsing error
});
// Race against timeout
return Promise.race([
extractPromise,
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Extraction timeout')), 30000)
)
]);
}
Security Standards
- CWE-834: Excessive Iteration — https://cwe.mitre.org/data/definitions/834.html
- OWASP Input Validation Cheat Sheet — https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html
- npm security best practices — https://docs.npmjs.com/security
Key Takeaways
-
Never assume patch-level dependencies are safe: CVE-2026-73566 exists in
tar7.5.19, a seemingly minor version behind 7.5.21. Automated scanning catches what manual review misses. -
The
tarpackage innode-gypdependency chains requires explicit monitoring: Becausenode-gypbundlestarfor native module compilation, vulnerable versions can exist even in projects that don't directly use tar extraction. -
Infinite loops in parsing logic are exploitable DoS vectors: When processing untrusted archive formats, always implement external timeouts and resource limits regardless of library security.
-
Upgrade paths for
package-lock.jsonvulnerabilities must modify both files: Changing onlypackage.jsonleaves lockfile inconsistencies. The automated PR correctly updates both with synchronized version bumps. -
The
integrityhash inpackage-lock.jsonserves as a tamper-evident seal: The SHA-512 change from4LeEWl96twn...toXdhtCvlMyww...cryptographically verifies the package content difference between vulnerable and patched versions.
How Orbis AppSec Detected This
Source: User-influenced file upload data entering through HTTP request bodies containing tar archive uploads.
Sink: The tar.extract() and tar.x() API methods in the node_modules/tar package, specifically within the GNU LongLink header parsing logic that processes ././@LongLink entries.
Missing control: Absent bounds validation on LongLink header size fields before the extraction loop, allowing pathological path lengths to trigger unbounded iteration.
CWE: CWE-834 (Excessive Iteration) — the code enters a loop based on attacker-controlled size values without adequate termination conditions.
Fix: Upgraded tar from 7.5.19 to 7.5.21 in package.json and package-lock.json, which implements strict path length validation and guaranteed loop termination.
Orbis AppSec automatically detected this vulnerability and opened a pull request with the fix. Try Orbis AppSec on your repositories to find and fix issues like this automatically.
Conclusion
CVE-2026-73566 demonstrates how even mature, widely-used packages like tar can harbor subtle DoS vulnerabilities in edge-case parsing logic. The 7.5.19 → 7.5.21 upgrade shows that security fixes don't require API changes—just rigorous input validation and defensive programming.
For Node.js developers, this case reinforces the importance of:
- Automated dependency scanning in CI/CD pipelines
- Understanding your transitive dependency tree
- Applying defense-in-depth with timeouts and resource limits
The patch is available now. If your package-lock.json shows tar at any version below 7.5.21, upgrade immediately—before an attacker sends your application into an infinite loop.
References
- CWE-834: Excessive Iteration — https://cwe.mitre.org/data/definitions/834.html
- OWASP Input Validation Cheat Sheet — https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html
- node-tar official documentation — https://www.npmjs.com/package/tar
- Semgrep rule for tar extraction vulnerabilities — https://semgrep.dev/r?q=javascript.lang.security.audit.tar-extract
- fix: upgrade tar to 7.5.21 (CVE-2026-73566)