Abstract
LLM-based code interpreter agents are increasingly deployed in critical workflows, yet their robustness against risks introduced by their code execution capabilities remains underexplored. Existing benchmarks are limited to static datasets or simulated environments, failing to capture the security risks arising from dynamic code execution, tool interactions, and multi-turn context. To bridge this gap, we introduce CIBER, an automated benchmark that combines dynamic attack generation, isolated secure sandboxing, and state-aware evaluation to systematically assess the vulnerability of code interpreter agents against four major types of adversarial attacks: Direct/Indirect Prompt Injection, Memory Poisoning, and Prompt-based Backdoor. We evaluate six foundation models across two representative code interpreter agents (OpenInterpreter and OpenCodeInterpreter), incorporating a controlled study of identical models. Our results reveal that Interpreter Architecture and Model Alignment Set the Security Baseline. Structural integration enables aligned specialized models to outperform generic SOTA models. Conversely, high intelligence paradoxically increases susceptibility to complex adversarial prompts due to stronger instruction adherence. Furthermore, we identify a "Natural Language Disguise" Phenomenon, where natural language functions as a significantly more effective input modality than explicit code snippets (+14.1% ASR), thereby bypassing syntax-based defenses. Finally, we expose an alarming Security Polarization, where agents exhibit robust defenses against explicit threats yet fail catastrophically against implicit semantic hazards, highlighting a fundamental blind spot in current pattern-matching protection approaches.
Introduction
The landscape of Large Language Models (LLMs) is shifting from passive text generators to active autonomous agents capable of a "Think-Code-Execute" loop. Tools like OpenInterpreter can autonomously write code, interact with operating systems, and manage files. While these capabilities significantly enhance productivity, they also escalate security risks from theoretical text generation to actual Remote Code Execution (RCE) and data exfiltration.
Current security benchmarks for LLMs are predominantly static, relying on text matching or simulated environments. These methods fail to capture the physical runtime side-effects of code interpreters. Furthermore, existing evaluations often treat the agent as a black box, ignoring how the underlying model's intelligence interacts with architectural guardrails under active, multi-modal adversarial attacks.
The CIBER Framework
To address these limitations, we developed CIBER, an automated framework designed for dynamic, state-aware security evaluation. CIBER consists of three core modules:
- Attack Generation: This module constructs adversarial payloads using four primary methods: Direct Prompt Injection (DPI), Indirect Prompt Injection (IPI), Memory Poisoning Attack (MPA), and Prompt-Based Backdoor (PBD). These attacks are generated across three modalities: Natural Language, Code Descriptions, and explicit Code Snippets.
- Isolated Execution: The target agent operates within a secure Docker sandbox. This environment captures both the agent's textual responses and actual environmental changes, such as file deletions or unauthorized process creations.
- State-Aware Evaluation: Unlike traditional benchmarks that may rely solely on text output, CIBER employs a two-stream verification logic. It analyzes the agent's intent (text output) and performs state verification (forensic probes of the Docker container) to categorize outcomes as Safe Rejections, Attempted Attacks, or Successful Attacks.
Experimental Setup
The evaluation utilizes an adapted version of the RedCode dataset, encompassing 25 security risk scenarios across 8 domains, including File Systems, Cyber Security, and Operating Systems. We generated a comprehensive test suite of 57,000 instances to evaluate six foundation models across two contrasting agent architectures:
- OpenInterpreter: An execution-first architecture that relies heavily on model alignment for safety.
- OpenCodeInterpreter: A "secure-by-design" architecture that incorporates sandboxing and syntax filters.
Key Results and Analysis
Our evaluation reveals several critical insights into the security posture of code interpreter agents.
The Intelligence Paradox and Architecture
A significant finding is that higher reasoning capabilities do not necessarily equate to better security. Highly capable models, such as GPT-4o, can be more susceptible to complex adversarial prompts because their strong instruction-following capabilities may override their safety alignment.
As shown in the results, the specialized OpenCodeInterpreter-CL-7B model achieved a lower overall Attack Success Rate (ASR) of 51.4% compared to GPT-4o on the OpenInterpreter framework (69.3% ASR). This suggests that architectural guardrails and specific model alignment are crucial for establishing a security baseline.
Vulnerabilities in Modality and Context
We identified a "Natural Language Disguise" phenomenon, where malicious code presented as step-by-step natural language instructions is more effective than explicit code snippets. "Code Descriptions" achieved the highest global ASR at 62.5%, compared to 48.4% for "Code Snippets," likely because natural language bypasses structural filters like Abstract Syntax Tree (AST) analysis.
Furthermore, agents proved highly vulnerable to attacks injected into "trusted" background contexts. Memory Poisoning emerged as the most significant threat with a 73.3% average ASR, followed by Indirect Prompt Injection at 71.8%.
Conclusion
CIBER exposes a fundamental "Security Polarization" in current agents: while they are effective at blocking explicit, obvious threats, they fail against implicit semantic hazards requiring deep domain knowledge. To mitigate these risks, we propose a three-layered defense strategy:
- Semantic Firewalls to detect natural language disguises.
- Zero-Trust Data Handling using taint-tracking for tool outputs.
- Cryptographic History Authentication to prevent memory poisoning.
Future work will expand to cover zero-day attacks and subtle side-channel leaks to further harden autonomous agent security.
Summary updated