Security Evaluation of AI Agent Harnesses: A Practical Methodology
This article breaks down how to evaluate the security of AI agent harnesses (agent execution frameworks). It defines the review target and threat model, then examines four core mechanisms—plugin trees, event sourcing, capability seams, and layered sandboxes—along with the specific verification points for each. It also covers the risks of dynamic plugins and provides a practical evaluation checklist covering injection, sandbox escape, credential leakage, reproducibility, and configuration changes.
1. Define the Target and the Threat Model First
When reviewing an AI agent harness for security, the most common mistake is to start with a feature checklist and tick items off one by one. A more reliable order is to first define the form of the system under review, then clarify the trust boundaries and the attacker’s goals, and only then move on to verifying mechanisms.
The systems under review usually share one trait: everything is a plugin. The model adapter layer, the tool registry, the session log, and even the main loop that drives multi-turn reasoning all exist as plugins, composed and swapped through configuration. This design offers strong evolvability, but it also means the attack surface grows linearly with the number of plugins, and combinatorial explosion can cause the risk of “configuration as code” to be underestimated.
The trust assumption must be fixed in place: the model is a semi-trusted subject. It may suffer prompt injection from malicious web pages, poisoned repository content, or externally fetched documents. It may also be deployed in read-only mode to process entirely untrusted code repositories. The attacker’s ultimate goals are only two: execute arbitrary code on the host, or exfiltrate credentials to an external destination. Therefore, “read-only” is not a marketing slogan but a security commitment that must be verifiable.
2. Four Core Mechanisms and Their Verification Points
2.1 Plugin Tree: Blurred Boundaries from Replaceability
The benefit of a plugin architecture is low replacement cost; the price is that “who can change the configuration” becomes a new permission problem. The review should confirm whether plugin loading has permission declarations and signature verification, whether configuration changes are written to the audit log, and whether security constraints still hold after the main loop is replaced, rather than being bypassed along with the plugin.
2.2 Event Sourcing: Model-Visible Means Logged
The session log uses append-only writes, following the principle that everything the model can see must be reconstructable from the log. The value of this constraint is replayability: any privilege escalation attempt can be fully replayed. The verification method is to randomly pick a session and reconstruct the model context using only the log. If any field cannot be reconstructed, there is a side channel that bypasses the log, which is a high-risk signal.
2.3 Capability Seams: A Three-Role Split
Each replaceable capability consists of three roles: the service definition, the capability provider, and the capability consumer. This split allows permission checks to be centralized at the seam rather than scattered across individual tool implementations. The review focuses on whether the consumer can access the capability only through the seam, and whether the provider can be registered by an untrusted plugin to carry out capability hijacking.
2.4 Layered Sandbox: Defense in Depth, Not a Single Point
Command execution must go through a unified sandbox entry point, wrapping arguments and processes with kernel-level mechanisms such as filesystem view restrictions, system call filtering, and namespace isolation. File writes are bounded by in-process fences. Permission modes should have at least three tiers: read-only, workspace-write, and full access. An example is shown below:
Permission mode Read scope Write scope Networkread-only repo root none restrictedworkspace-write repo root within workspace restrictedfull-access host host open
The review point is the default: the default tier must be read-only, and elevating permissions requires an explicit, auditable action.
3. Dynamic Plugins: The Highest-Risk Area
The model can write and run code itself through define-and-run tools, mount the result as its own plugin, and execute it in a restricted virtual machine sandbox, accessing services only through a guarded facade. Four things must be verified here: a virtual machine sandbox is not equal to a security boundary, so confirm whether escape is possible; whether the facade performs argument-level validation rather than only entry-point interception; whether the plugin lifecycle can be reclaimed; and whether plugin registration is audited and can be revoked with one action.
4. A Practical Evaluation Checklist
- Injection cases: construct documents and repository files containing hidden instructions, and verify that read-only mode performs no write operations and sends no outbound requests.
- Escape cases: attempt to bypass the sandbox fence through command concatenation, environment variables, and temporary file path traversal.
- Credential cases: check whether logs and error messages leak tokens, and whether credentials are issued with least privilege and short-lived.
- Reproducibility cases: replay a complete session using only the log, and verify reconstruction consistency.
- Configuration cases: verify that all plugin and permission changes are recorded and can be rolled back.
5. Conclusion
The security of a plugin-based agent framework does not depend on the number of plugins, but on whether the seams are converged, whether the log is reconstructable, whether the sandbox is layered, and whether the default permissions are conservative enough. Turning these four points into automated regression cases and integrating them with general-purpose cloud logging services, monitoring and alerting, and key management capabilities is what allows the “read-only commitment” baseline to hold during rapid iteration.
