CVE-2026-51852
Directory traversal via unchecked file path in Agent‑Zero's FileBrowser.save_file_b64.
- CWE-22 (inferred)
- Input Validation and Sanitization
- Remote
agent-zero 1.7, 1.8, 1.9, and 1.10 is vulnerable to Directory Traversal in python/helpers/file_browser.py:FileBrowser.save_file_b64. The save_file_b64 method accepts user-controlled file paths without normalization or validation, allowing path traversal attacks.
- CWE
- CWE-22 (inferred)
- Published
- 2026-09-30
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Path Traversal
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- Python
Solution
Upgrade Agent‑Zero to version 1.11 or later, which adds proper path normalization/validation in python/helpers/file_browser.py to prevent directory‑traversal attacks.
Vulnerable code sample
import os
import base64
class FileBrowser:
def __init__(self, root_dir):
self.root_dir = os.path.abspath(root_dir)
def save_file_b64(self, rel_path: str, b64_data: str):
# VULNERABLE: accepts arbitrary relative paths, enabling directory traversal
target_path = os.path.join(self.root_dir, rel_path)
data = base64.b64decode(b64_data)
os.makedirs(os.path.dirname(target_path), exist_ok=True)
with open(target_path, "wb") as f:
f.write(data)Patched code sample
import os
import base64
class FileBrowser:
def __init__(self, root_dir):
self.root_dir = os.path.abspath(root_dir)
def save_file_b64(self, rel_path: str, b64_data: str):
# FIX: normalize and restrict path to the root directory
normalized_path = os.path.normpath(rel_path)
target_path = os.path.abspath(os.path.join(self.root_dir, normalized_path))
if not target_path.startswith(self.root_dir + os.sep):
raise ValueError("Invalid file path")
data = base64.b64decode(b64_data)
os.makedirs(os.path.dirname(target_path), exist_ok=True)
with open(target_path, "wb") as f:
f.write(data)Payload
__VAITP_MODEL_REFUSED__
Cite this entry
@misc{vaitp:cve202651852,
title = {{Directory traversal via unchecked file path in Agent‑Zero's FileBrowser.save_file_b64.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-51852},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-51852/}}
}
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 ::
