/

CVE-2026-51851

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in Agent Zero File Browser

CVE-2026-51851

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Unauthorized file write

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Agent Zero's FileBrowser.save_text_file accepts user-controlled file paths without adequate normalization or validation. If an attacker can influence the path supplied to this method, they may be able to write files outside the intended directory, subject to the permissions of the application process.

Affected context

The issue is described in Agent Zero versions 1.7, 1.8, 1.9, and 1.10, in python/helpers/file_browser.py within FileBrowser.save_text_file. It becomes relevant when user-controlled paths reach this method and are used for file writes without checks that constrain the destination to an intended directory.

Exploit preconditions

  • Attack surface: The file browser's text-file save functionality
  • Required access: Ability to supply or influence a path processed by save_text_file; the description does not specify whether authentication is required
  • Trigger point: The method writes text to a destination derived from the supplied path
  • Why exploitation is possible: The path is not normalized or validated to prevent traversal beyond the intended location

Why this happens

The method uses a user-controlled file path for writing without establishing that the resolved destination remains within an allowed directory. This is a path traversal weakness mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The insecure pattern is trusting a supplied pathname without applying canonicalization and enforcing an appropriate directory boundary.

Potential impact

  • An attacker may write or overwrite files outside the intended directory, subject to the process's filesystem permissions.
  • Application data or configuration files could be altered.
  • Files written to locations consumed by other processes could contribute to further compromise, depending on the environment and permissions.

General mitigation guidance

Defensive patterns include resolving candidate paths to canonical destinations and verifying they remain within an explicitly allowed directory before writing. Prefer server-controlled identifiers mapped to approved paths over accepting arbitrary pathnames, and apply strict validation to path inputs. Limit the application's filesystem write permissions and isolate writable data from code, configuration, and sensitive files.

How teams detect issues like this

  • Use static analysis to identify file-write operations whose paths originate from user-controlled input without canonicalization or boundary checks.
  • Review code for path joins that assume a relative path stays within a designated directory.
  • Enforce code-review or CI policies requiring destination containment checks for user-influenced file operations.
  • Monitor application writes to unexpected directories and review filesystem permissions for the process.

Sources

SourceLink
gist.github.comgist.github.com/Ro1ME/a1bbf47465175e279a72121cd0df298b
github.comgithub.com/agent0ai/agent-zero/issues/1541

Frequently asked

questions

The described flaw is in the text-file save operation. The possible destinations depend on how the method is exposed and on the application process's filesystem permissions.

An attacker must be able to influence a path processed by save_text_file. The vulnerability description does not establish whether that requires authentication or another form of access.

Resolve the destination to a canonical path and verify that it remains inside an explicitly permitted directory before writing.

Avoid using untrusted pathnames directly, prefer server-controlled identifiers for file selection, and combine path-boundary checks with least-privilege filesystem permissions.

Find out what's already
exploitable in your codebase.