CVE-2024-12905

7.5 HIGH

📋 TL;DR

This vulnerability in tar-fs allows attackers to write files outside the intended extraction directory when processing malicious tar archives. It affects applications using vulnerable versions of tar-fs for archive extraction. The issue combines path traversal with symlink following to bypass directory restrictions.

💻 Affected Systems

Products:
  • tar-fs npm package
Versions: tar-fs: 0.0.0 to <1.16.4, 2.0.0 to <2.1.2, 3.0.0 to <3.0.8
Operating Systems: All operating systems where Node.js and tar-fs run
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using tar-fs for archive extraction is vulnerable by default. The vulnerability is triggered when extracting malicious tar files.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise through arbitrary file writes, potentially leading to remote code execution, data destruction, or privilege escalation.

🟠

Likely Case

Unauthorized file overwrites or creation in sensitive directories, potentially modifying configuration files, planting backdoors, or exfiltrating data.

🟢

If Mitigated

Limited to the user context running the tar-fs process, with damage contained to accessible directories based on process permissions.

🌐 Internet-Facing: MEDIUM - Exploitation requires tar file upload/processing capability, which is common in web applications but not always exposed.
🏢 Internal Only: MEDIUM - Internal systems processing user-uploaded archives or automated extraction workflows remain vulnerable.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires crafting a malicious tar archive with symlinks and path traversal elements. No public exploit code is known, but the vulnerability is well-documented.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: tar-fs 1.16.4, 2.1.2, or 3.0.8

Vendor Advisory: https://github.com/mafintosh/tar-fs/commit/a1dd7e7c7f4b4a8bd2ab60f513baca573b44e2ed

Restart Required: No

Instructions:

1. Update tar-fs dependency in package.json to ^1.16.4, ^2.1.2, or ^3.0.8. 2. Run 'npm update tar-fs' or 'yarn upgrade tar-fs'. 3. Test archive extraction functionality.

🔧 Temporary Workarounds

Validate tar files before extraction

all

Implement pre-extraction validation to check for malicious symlinks and path traversal attempts.

Use extraction in isolated container

all

Run tar extraction in a sandboxed environment with restricted filesystem access.

🧯 If You Can't Patch

  • Disable tar file processing functionality if not essential
  • Implement strict input validation and whitelist allowed tar file sources

🔍 How to Verify

Check if Vulnerable:

Check package.json or run 'npm list tar-fs' to see installed version. If version falls in affected ranges, system is vulnerable.

Check Version:

npm list tar-fs | grep tar-fs

Verify Fix Applied:

After updating, verify version is 1.16.4+, 2.1.2+, or 3.0.8+ using 'npm list tar-fs'. Test extraction with known safe archives.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected file writes outside extraction directory
  • Failed file access attempts to restricted paths
  • Process crashes during tar extraction

Network Indicators:

  • Large or unusual tar file uploads to extraction endpoints

SIEM Query:

Process execution logs showing tar-fs extraction followed by file writes to unexpected locations

🔗 References

📤 Share & Export