CVE-2025-4435
📋 TL;DR
This vulnerability in Python's tarfile module allows filtered tar archive members to be extracted when they should be skipped, bypassing intended security filters. This affects applications using Python's tarfile module with errorlevel=0 and custom extraction filters. Attackers could exploit this to extract malicious files that should have been blocked.
💻 Affected Systems
- Python
⚠️ 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.
- Review the CVE details at NVD
- Check vendor security advisories for your specific version
- Test if the vulnerability is exploitable in your environment
- Consider updating to the latest version as a precaution
⚠️ Risk & Real-World Impact
Worst Case
Malicious tar archives could bypass security filters and extract malware, backdoors, or sensitive files to arbitrary locations, potentially leading to remote code execution or data exfiltration.
Likely Case
Attackers could bypass tar extraction filters to place malicious files in unexpected locations, potentially leading to privilege escalation or persistence mechanisms.
If Mitigated
With proper input validation and sandboxing, the impact is limited to unexpected file extraction without execution capabilities.
🎯 Exploit Status
Exploitation requires the attacker to provide a malicious tar file and the victim to process it with vulnerable tarfile configuration.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Python 3.13.1 and later; backported to 3.12.x, 3.11.x, 3.10.x, 3.9.x, 3.8.x (check specific patch versions)
Vendor Advisory: https://github.com/python/cpython/security/advisories
Restart Required: No
Instructions:
1. Update Python to patched version. 2. For systems with Python from OS package manager, use system update commands. 3. For custom Python installations, download and install from python.org or use package manager.
🔧 Temporary Workarounds
Use errorlevel=2
allSet tarfile.errorlevel=2 instead of 0 to maintain proper filter behavior
tarfile.errorlevel = 2
Avoid custom filters with errorlevel=0
allDo not use custom extraction filters when errorlevel is set to 0
🧯 If You Can't Patch
- Implement strict input validation for tar files from untrusted sources
- Run tar extraction in sandboxed/isolated environments with limited permissions
🔍 How to Verify
Check if Vulnerable:
Check Python version and verify if tarfile extraction with errorlevel=0 and filters behaves incorrectly
Check Version:
python --version
Verify Fix Applied:
Test tar extraction with errorlevel=0 and filters to confirm filtered members are properly skipped
📡 Detection & Monitoring
Log Indicators:
- Unexpected tar extraction logs
- Files appearing in locations that should be filtered
Network Indicators:
- Inbound tar files to applications using Python tarfile module
SIEM Query:
Process execution with tarfile module AND (errorlevel=0 OR custom filters)
🔗 References
- https://github.com/python/cpython/commit/19de092debb3d7e832e5672cc2f7b788d35951da
- https://github.com/python/cpython/commit/28463dba112af719df1e8b0391c46787ad756dd9
- https://github.com/python/cpython/commit/3612d8f51741b11f36f8fb0494d79086bac9390a
- https://github.com/python/cpython/commit/4633f3f497b1ff70e4a35b6fe2c907cbe2d4cb2e
- https://github.com/python/cpython/commit/9c1110ef6652687d7c55f590f909720eddde965a
- https://github.com/python/cpython/commit/9e0ac76d96cf80b49055f6d6b9a6763fb9215c2a
- https://github.com/python/cpython/commit/aa9eb5f757ceff461e6e996f12c89e5d9b583b01
- https://github.com/python/cpython/commit/dd8f187d0746da151e0025c51680979ac5b4cfb1
- https://github.com/python/cpython/issues/135034
- https://github.com/python/cpython/pull/135037
- https://mail.python.org/archives/list/security-announce@python.org/thread/MAXIJJCUUMCL7ATZNDVEGGHUMQMUUKLG/