Summary
OpenHarness prior to commit 166fcfe contains an improper access control flaw in its built-in file tools, caused by inconsistent parameter handling during permission checks.
An attacker who can influence agent tool execution can bypass path-based deny rules to read, create, or overwrite arbitrary files outside the intended repository scope, potentially exposing sensitive configuration, credential, or SSH material.
Affected context
This vulnerability arises in OpenHarness environments where:
- The built-in file tools (e.g.,
read_file,write_file,edit_file,notebook_edit) are enabled for agents - Permission enforcement relies on a PermissionChecker that should validate file paths against repository or host constraints
- Agents can run in modes (such as
full_auto) that allow them to autonomously invoke file tools
The issue manifests when the path parameter used by file tools is not correctly forwarded into the permission checking logic, leading to a discrepancy between what the tool can access and what the policy intends to restrict.
Exploit preconditions
- Attack surface: Agent tool invocation layer (e.g., workflows, prompts, or orchestration that can trigger file tools)
- Required access: Ability to influence or control agent actions so that it calls
read_file,write_file,edit_file, ornotebook_editwith attacker-chosen paths - Trigger point: Execution of a file tool operation where the
pathargument is evaluated by the tool but not fully considered by the PermissionChecker - Why exploitation is possible: The permission enforcement logic does not receive or consistently use the actual file path parameter, so deny rules and repository scoping are not reliably applied; the tool proceeds with file operations on paths outside the intended sandbox.
Why this happens
The defect stems from a mismatch between the security policy model and its implementation in the file tooling layer.
The PermissionChecker is intended to apply path-based authorization, but the path parameter is not correctly propagated or referenced in permission checks for operations like read_file, write_file, edit_file, and notebook_edit.
This leads to CWE-863: Improper Authorization, where the system performs security checks that are incomplete or not aligned with the resource actually being accessed.
As a result, authorization decisions are made without full awareness of the targeted file path, allowing operations on files that should be denied by configuration or host-level policies.
Potential impact
- Reading arbitrary local files outside the intended repository scope
- Exposure of configuration files containing secrets, API keys, or environment details
- Access to credential stores, SSH keys, and other authentication material
- Creation of new files in sensitive host directories that may affect application behavior
- Overwriting existing files in restricted paths, potentially enabling configuration tampering or persistence mechanisms
- Indirect escalation of access if modified files are later executed or trusted by other components
General mitigation guidance
Mitigation should focus on ensuring that authorization decisions are tightly bound to the actual resources being accessed and that tooling cannot bypass policy intent.
Common defensive patterns include:
- Enforcing that all file operations pass the canonical, fully-resolved path into the authorization layer before any I/O occurs
- Centralizing permission checks in a single, reusable function that every file tool must call, avoiding duplicated or ad-hoc logic
- Designing file tools to operate solely inside a well-defined, sandboxed directory tree, rejecting paths that attempt to traverse outside it
- Applying a default-deny posture for file access, where new tools or operations must explicitly declare their allowed path patterns
- Running agents with OS-level least privilege (e.g., dedicated low-privilege users, chroot/jail/containers) so that even if logical checks fail, the file system exposure is minimized
These patterns help decouple security from individual tool implementations and reduce the risk of inconsistencies in parameter handling.
How teams detect issues like this
Effective detection approaches may combine code-level review with behavior monitoring:
- Static analysis rules that flag authorization checks which do not include the resource identifier (e.g., missing or unused
pathparameter in permission calls) - Code review checklists that require verification that all file operations are preceded by a single, standardized permission-check function using the same parameters
- Automated tests or policy-as-code checks that attempt file operations outside the permitted repository scope and assert denial
- Runtime logging of file tool invocations capturing requested paths and the authorization decision, with alerts when access to non-repository directories is granted
- Periodic audits of agent configurations and tool permissions to identify overly broad capabilities or full-auto modes without strong guardrails
Automated review tools can assist by enforcing patterns around permission-check APIs and by spotting deviations from approved access-control flows.

