CVE-2026-71284
Improperly sanitized tar filename leads to OS command injection via os.system.
- CVSS 7.2
- CWE-78
- Input Validation and Sanitization
- Remote
Fledge's backup-restore upload handler, upload_backup (python/fledge/services/core/api/backup_restore.py), takes the first extracted tar member's filename (tar_file_names[0]) and builds a shell command via string formatting. Because os.system invokes a shell and no quoting (shlex.quote, list-form subprocess) is applied, an admin uploading a crafted backup archive achieves arbitrary OS command execution.
- CWE
- CWE-78
- CVSS base score
- 7.2
- Published
- 2026-08-05
- OWASP
- A03 Injection
- Orthogonal defect classification
- Interface
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Python
Solution
Upgrade Fledge to v1.12.0 (or newer), which sanitises the backup‑restore upload handler by using a list‑form subprocess call (or proper shlex quoting) instead of os.system. This eliminates the arbitrary command execution vulnerability.
Vulnerable code sample
import os
import tarfile
def upload_backup(archive_path: str, restore_dir: str) -> None:
"""Extract first file from a tar archive and invoke the restore script."""
with tarfile.open(archive_path, "r:gz") as tar:
members = tar.getmembers()
if not members:
raise ValueError("Empty backup archive")
# Extract only the first member to the restore directory
tar.extractall(path=restore_dir, members=[members[0]])
# Build a shell command using the extracted filename
first_name = members[0].name
# VULNERABLE: unsanitized command built with string formatting and os.system
os.system(f"/usr/local/bin/restore.sh {restore_dir}/{first_name}")Patched code sample
import os
import tarfile
import subprocess
import shlex
def upload_backup(archive_path: str, restore_dir: str) -> None:
"""Extract first file from a tar archive and invoke the restore script."""
with tarfile.open(archive_path, "r:gz") as tar:
members = tar.getmembers()
if not members:
raise ValueError("Empty backup archive")
tar.extractall(path=restore_dir, members=[members[0]])
first_name = members[0].name
# FIX: use list‑form subprocess.run with proper quoting
cmd = ["/usr/local/bin/restore.sh", os.path.join(restore_dir, first_name)]
subprocess.run(cmd, check=True)Cite this entry
@misc{vaitp:cve202671284,
title = {{Improperly sanitized tar filename leads to OS command injection via os.system.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-71284},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-71284/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
