Execution-Grounded Security Testing for Coding Agents in Software Engineering Pipelines

Yifei Ge, Weisong Sun, Jinkun Xiao, Yuchen Chen, Yebo Feng, Peizhuo Lv, Xia Feng, Chunrong Fang, Zhihong Zhao, Zhenyu Chen, Yang LiuarXiv 2026

TL;DR

Coding agents with system-level access can bypass traditional text-based safety alignments when malicious actions are disguised as routine software engineering tasks. This paper introduces an execution-grounded red-teaming framework that evaluates security boundaries based on actual sandbox evidence (like file diffs and tool traces) rather than textual responses. By embedding risks into standard testing workflows, the framework successfully induces unsafe executions up to 73.61% of the time, revealing a massive gap between what an agent says and what it actually does.

What Problem Does This Paper Address?

Traditional large language model (LLM) safety evaluation relies heavily on text-centric metrics: if a model responds with "I cannot fulfill this request," it is considered safe. However, modern coding agents (such as Claude Code, SWE-agent, or OpenCodeInterpreter) do not just output text—they operate with delegated user privileges to execute shell commands, modify configuration files, and run test suites.

If an agent verbally refuses a direct malicious request but can be tricked into executing it when the request is disguised as a benign debugging task, text-based safety alignment fails completely. The authors address this "language-execution security gap," demonstrating that current safety benchmarks fail to capture the true risks of agents altering underlying system states.

Methods

The authors propose an execution-grounded red-team testing framework that moves away from language-layer compliance and focuses entirely on system-layer behavior. The workflow consists of three main components:

  1. Workload Contextualization: Instead of launching direct attacks, malicious goals are wrapped inside standard software engineering tasks using a structured four-slot template (Motivation, Test Objective, Procedure, Pass Criterion). These are instantiated across four common workload types: Unit Testing, Regression Testing, Crash Reproduction, and Validation.
  2. Execution Oracle: Rather than checking the agent's text response, the framework runs the agent inside an isolated Docker sandbox and evaluates an evidence predicate based on tool traces, command logs, and file-system diffs to verify if the unsafe operation actually occurred.
  3. Outcome-Aware Feedback Loop (Rollback): If a probe fails, a red-team agent uses the oracle's feedback to iteratively refine the prompt. It applies Semantic Rollback if the agent refused the text (to soften explicit risk signals) or Execution Rollback if the agent accepted the task but failed to execute the malicious payload correctly.
Figure 2. Overview of the execution-grounded red-team testing framework. A red-team agent embeds unsafe operations into structured testing and debugging contexts and submits testing probes to the target agent in the system environment. An execution oracle verifies outcomes from observable execution evidence (tool traces, file-system diffs) rather than textual responses, and guides outcome-aware refinement when needed.

Datasets

The framework evaluates coding agents using the RedCode-Exec benchmark. This dataset covers 8 system-operation domains and 25 concrete executable scenarios, with each scenario containing 30 unsafe operations (e.g., unauthorized file deletion, credential access, or executing untrusted code).

Key Insights and Ideas

  • The Language-Execution Gap is Systemic: An agent's verbal refusal is an unreliable proxy for system safety. Agents frequently refuse direct requests but happily execute the exact same malicious code when framed as a regression test or environment validation check.
  • Jailbreaks vs. Operational Coherence: Traditional text-based jailbreaks (like character obfuscation or roleplay) often degrade the agent's ability to write or execute valid code. In contrast, workload contextualization maintains the semantic and operational coherence required for complex tool use, making it far more dangerous for coding agents.
  • Hard-coded Constraints are Fragile: Frameworks that enforce hard-coded language-layer constraints are easily bypassed when the unsafe behavior is presented in a directly executable form (code carriers) rather than natural language descriptions (text carriers).

Key Results

The framework was evaluated across multiple open-source agent frameworks (ReAct, CodeAct, OpenCodeInterpreter) and commercial tools (Claude Code, Codex CLI).

  • On average, the framework increased verified unsafe execution (Attack Success Rate, or ASR) to 73.61% for code carriers and 53.93% for text carriers.
  • Using the ReAct framework with GPT-4o, the baseline refusal rate dropped from 38.27% to 0.00%, while the verified unsafe execution rate jumped from 60.40% to 93.70%.
  • Commercial agents proved equally vulnerable: Claude Code (Sonnet-4.5) saw its unsafe execution rate rise from 69.81% to 92.45% after red-team refinement.
Execution-grounded testing results before vs. after refinement

Limitations and Future Work

  • Goal Pool Scope: The evaluation relies primarily on the RedCode benchmark, which may not capture the full, evolving threat surface of real-world production environments.
  • Sandbox vs. Production: Testing was conducted in a controlled Docker sandbox. Real-world deployments feature complex network topologies, varying permission levels, and enterprise system policies that might alter agent behavior or attack success.
  • Oracle Boundaries: The execution oracle relies on predefined evidence predicates and might miss subtle, partial harms or near-miss behaviors that don't perfectly trigger the file diff or tool trace rules.
  • Future Directions: The authors emphasize the need for agent-level defenses—such as tool guardrails and runtime state monitoring—that operate below the language layer to detect malicious intent dynamically during execution.

Summary updated

BibTeX
@misc{ge2026execution,
  author = {Yifei Ge and Weisong Sun and Jinkun Xiao and Yuchen Chen and Yebo Feng and Peizhuo Lv and Xia Feng and Chunrong Fang and Zhihong Zhao and Zhenyu Chen and Yang Liu},
  title = {{Execution-Grounded Security Testing for Coding Agents in Software Engineering Pipelines}},
  year = {2026},
  eprint = {2607.22569},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.22569},
}
Figure