Red-Teaming Agent Execution Contexts: Open-World Security Evaluation on OpenClaw

Hongwei Yao, Yiming Liu, Yiling He, Bingrun Yang

TL;DR

This paper introduces DEEPTRAP, an automated framework for finding security vulnerabilities in agentic AI systems like OpenClaw. Instead of just looking at the final output, DEEPTRAP analyzes the entire execution trajectory to uncover how malicious context manipulations can lead to unsafe behavior while the agent still appears to complete its task.

What Problem Does This Paper Address?

Modern AI agents, especially those built on large language models (LLMs) and designed for complex tasks, don't just rely on user prompts. They interact with a rich "execution context" that includes files, memory, tools, and other resources. This expanded attack surface creates new security risks: what if these contextual components are compromised? Traditional security evaluations often focus on the user's direct input (prompt injection), but this paper highlights a more insidious threat: an agent can be tricked into performing unsafe actions not because of a malicious prompt, but because its environment has been subtly altered. This is particularly concerning because the agent might still produce a seemingly correct output, masking the underlying vulnerability. The challenge is to systematically discover these "contextual vulnerabilities" in a black-box, dynamic environment.

Methods

DEEPTRAP tackles this challenge with a multi-stage approach:

  1. Risk-Conditioned Evaluation: For a given benign user instruction and a target risk category (e.g., privacy leakage), DEEPTRAP defines what constitutes "unsafe" behavior and what the agent should be doing for the benign task.
  2. Adversarial Context Manipulation: The core idea is to generate "payloads" that, when injected into the agent's execution context, can trigger the target risk. This is framed as a black-box optimization problem.
  3. Multi-Objective Trajectory Scoring: Each generated context is tested by running the agent through a full "trajectory" (sequence of observations, actions, and context updates). The trajectory is then scored based on three criteria:
  4. Risk Realization: Did the attack succeed?
  5. Task Preservation: Did the agent still complete the benign task?
  6. Payload Stealth: Was the malicious manipulation hidden?
  7. Reward-Guided Beam Search: Since directly optimizing the complex, black-box problem is intractable, DEEPTRAP uses a beam search algorithm guided by the multi-objective reward. This efficiently explores promising contextual manipulations.
  8. Reflection-Based Deep Probing: To further refine the search, DEEPTRAP incorporates a "reflection" mechanism. It summarizes past successes and failures to inform future payload generation, allowing the system to learn and adapt its attack strategies over time.

Datasets

The paper introduces a 42-case benchmark for evaluating contextual vulnerabilities in OpenClaw. This benchmark is structured across:

  • Six vulnerability classes: Harness hijacking, privacy leakage, unauthorized execution, supply-chain risk, tool abuse, and encoding obfuscation.
  • Seven operational scenarios: Ranging from documentation processing and code checks to system administration.

This benchmark is used to evaluate nine different target LLM models.

Key Insights and Ideas

  • Execution Context is the New Attack Surface: The paper strongly argues that focusing solely on user prompts is insufficient. The mutable execution context of agentic systems is a critical and often overlooked vulnerability vector.
  • Stealthy Attacks are Plausible: The research demonstrates that agents can be compromised to perform malicious actions while still appearing to complete their intended tasks, making these vulnerabilities hard to detect through standard output checks.
  • Trajectory-Level Evaluation is Crucial: Failures often manifest in intermediate steps (e.g., unsafe file writes, tool misuse) rather than just the final output. Evaluating the entire execution trace is essential for comprehensive security assessment.
  • Automated Red-Teaming is Necessary: Manually crafting such complex contextual attacks is infeasible. DEEPTRAP's automated framework is key to discovering these vulnerabilities at scale.

Key Results

  • DEEPTRAP successfully exposed non-trivial contextual risks across most evaluated OpenClaw target models, often while preserving substantial task utility.
  • Privacy leakage was found to be the most consistently activated risk category across models.
  • Models like Qwen3.5-Plus, DeepSeek-v4-Flash, and DeepSeek-v4-Pro showed consistently high attack success rates (AGS) across various risks, indicating broad vulnerability.
  • Claude Sonnet 4.6 showed stronger resistance to some attacks.
  • The benchmark's diverse scenarios demonstrated that these risks are not tied to specific task templates, highlighting general weaknesses in agentic systems.
  • Iterative refinement in DEEPTRAP's search process led to improved attack discovery, with some risks (like encoding obfuscation) showing significant gains.

Limitations and Future Work

  • Model-Specific Vulnerabilities: While DEEPTRAP aims for generalizability, the paper notes that the effectiveness of certain attacks can vary significantly between models and even specific scenarios, suggesting that future work might explore more adaptive or model-specific red-teaming strategies.
  • Computational Cost: The framework relies on full agent rollouts for evaluation, which can be computationally intensive. While beam search and reflection help, further optimizations for efficiency could be beneficial.
  • Future Work: The authors suggest that future defenses should incorporate context integrity checks, execution-trace auditing, and risk-aware tool governance for more robust agentic AI deployment. The findings also underscore the need for more sophisticated security evaluation methods that go beyond simple prompt-response checks.

Summary updated

BibTeX
@inproceedings{yao2026red,
  author = {Hongwei Yao and Yiming Liu and Yiling He and Bingrun Yang},
  title = {{Red-Teaming Agent Execution Contexts: Open-World Security Evaluation on OpenClaw}},
  booktitle = {AIWILD @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=PpcTDVb0U8},
}
Figure