
CVE-2025-4517 (CVSS 9.4 – Critical) A vulnerability in Python's `tarfile`
CVE-2025-4517 (CVSS 9.4 – Critical)
A vulnerability in Python's tarfile module that allows arbitrary file writes outside the extraction directory when using TarFile.extractall() or TarFile.extract() with filter="data" or filter="tar".
Affected versions:
filter="data" or filter="tar"filter="data")Fixed in:
This PoC creates a malicious .tar archive that attempts to overwrite /etc/sudoers (adding a passwordless sudo entry for user wacky) when extracted on a vulnerable system.
DISCLAIMER
This code is provided strictly for educational purposes, authorized security research, CTF challenges and red-team exercises.
Do NOT use this against any system without explicit written permission.
Misuse may violate computer fraud and abuse laws in your jurisdiction.
.././etc.LNKTYPE) to alias a file inside the tar to the escaped path (/etc/sudoers).tarfile with vulnerable filter settings# 1. Save the PoC as generate_exploit.py
# 2. Run:
python3 generate_exploit.py