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.

