CVE-2025-45582

4.1 MEDIUM

📋 TL;DR

GNU Tar through version 1.35 contains a directory traversal vulnerability that allows file overwrite via a two-step process using crafted TAR archives. Attackers can exploit this by first extracting an archive with a symlink to a critical directory, then extracting another archive with files that follow that symlink path. This primarily affects server applications that automatically extract user-supplied archives and software installation processes that run 'tar xf' multiple times in the same directory.

💻 Affected Systems

Products:
  • GNU Tar
Versions: All versions through 1.35
Operating Systems: Linux, Unix-like systems, macOS, Windows (with GNU Tar port)
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability requires running 'tar xf' multiple times in the same directory with crafted archives. Default tar behavior is vulnerable when used in this specific pattern.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Critical system files could be overwritten, leading to privilege escalation, data destruction, or backdoor installation (e.g., overwriting SSH authorized_keys, system binaries, or configuration files).

🟠

Likely Case

Unauthorized file modification in user-writable directories, potentially compromising user data or application integrity in multi-user systems.

🟢

If Mitigated

Limited to file overwrite in directories where the user already has write permissions, with no privilege escalation beyond existing access.

🌐 Internet-Facing: MEDIUM - Exploitable on servers that automatically process user-uploaded TAR archives, but requires specific conditions (multiple archive extractions in same directory).
🏢 Internal Only: LOW - Requires local access and specific extraction patterns; most internal users would not be running multiple tar extractions in vulnerable configurations.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploit requires creating two specific archives and getting victim to extract them in sequence. Public proof-of-concept exists in vulnerability database references.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Not yet released

Vendor Advisory: https://lists.gnu.org/archive/html/bug-tar/2025-08/msg00012.html

Restart Required: No

Instructions:

Monitor GNU Tar releases for patch. Currently no official fix available. Consider workarounds below.

🔧 Temporary Workarounds

Extract to unique directories

linux

Always extract TAR archives to unique, empty directories to prevent symlink traversal between extractions.

mkdir -p /tmp/extract_$(date +%s) && tar xf archive.tar -C /tmp/extract_$(date +%s)

Use --one-top-level option

linux

Extract archives to a dedicated subdirectory using tar's built-in option.

tar xf archive.tar --one-top-level=extracted_files

🧯 If You Can't Patch

  • Implement strict input validation: reject any user-supplied TAR archives containing symlinks or paths with '..' components.
  • Run tar extraction processes with minimal privileges and in isolated environments (containers/chroots) to limit potential damage scope.

🔍 How to Verify

Check if Vulnerable:

Check tar version: tar --version | head -1. If version is 1.35 or earlier, system is vulnerable when used in multi-extraction scenarios.

Check Version:

tar --version | head -1

Verify Fix Applied:

Once patched version is available, verify with: tar --version | grep -q '1.36' && echo 'Patched' || echo 'Vulnerable'

📡 Detection & Monitoring

Log Indicators:

  • Multiple tar extraction operations in same directory within short timeframes
  • Tar operations with user-supplied archive names
  • Failed file write attempts to protected directories

Network Indicators:

  • Uploads of TAR archives to web applications or file transfer services

SIEM Query:

process.name="tar" AND command_line="*xf*" | stats count by host, command_line | where count > 1

🔗 References

📤 Share & Export