mlsanityData to 7 Oct 2026

RedCode: Risky Code Execution and Generation Benchmark for Code Agents

arXiv 2411.07781 ↗First posted 12 Nov 2024cs.SE cs.AIcited by 87

On the map: LLM agents and tool use → Agent threats, guardrails and governance

Abstract (arXiv)

With the rapidly increasing capabilities and adoption of code agents for AI-assisted coding, safety concerns, such as generating or executing risky code, have become significant barriers to the real-world deployment of these agents. To provide comprehensive and practical evaluations on the safety of code agents, we propose RedCode, a benchmark for risky code execution and generation: (1) RedCode-Exec provides challenging prompts that could lead to risky code execution, aiming to evaluate code agents' ability to recognize and handle unsafe code. We provide a total of 4,050 risky test cases in Python and Bash tasks with diverse input formats including code snippets and natural text. They covers 25 types of critical vulnerabilities spanning 8 domains (e.g., websites, file systems). We provide Docker environments and design corresponding evaluation metrics to assess their execution results. (2) RedCode-Gen provides 160 prompts with function signatures and docstrings as input to assess whether code agents will follow instructions to generate harmful code or software. Our empirical findings, derived from evaluating three agent frameworks based on 19 LLMs, provide insights into code agents' vulnerabilities. For instance, evaluations on RedCode-Exec show that agents are more likely to reject executing risky operations on the operating system, but are less likely to reject executing technically buggy code, indicating high risks. Risky operations described in natural text lead to a lower rejection rate than those in code format. Additionally, evaluations on RedCode-Gen show that more capable base models and agents with stronger overall coding abilities, such as GPT4, tend to produce more sophisticated and effective harmful software. Our findings highlight the need for stringent safety evaluations for diverse code agents. Our dataset and code are available at https://github.com/AI-secure/RedCode.

Key facts. Cited by 87 papers in the map (data through 7 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 25 of its 40 references that are in the map. First posted on arXiv 12 Nov 2024.

Builds on

25 of 40 references.

Closest ancestors · 4

Same direction, newest first

  1. 2024AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents19 Jun
  2. 2024R-Judge: Benchmarking Safety Risk Awareness for LLM Agents18 Jan
  3. 2023Testing Language Model Agents Safely in the Wild17 Nov
  4. 2023Identifying the Risks of LM Agents with an LM-Emulated Sandbox25 Sep

Other references · 21

  1. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
  4. 2023Qwen Technical Reportcited by 3,273
  5. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  7. 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,330
  8. 2023AgentBench: Evaluating LLMs as Agentscited by 1,211
  9. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  10. 2023Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!cited by 1,106
  11. 2023Teaching Large Language Models to Self-Debugcited by 963
  12. 2023Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Modelscited by 551
9 more
  1. 2024Executable Code Actions Elicit Better LLM Agentscited by 537
  2. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  3. 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 242
  4. 2024SALAD-Bench: A Hierarchical and Comprehensive Safety Benchmark for Large Language Modelscited by 225
  5. 2023Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Modelscited by 130
  6. 2023CRAFT: Customizing LLMs by Creating and Retrieving from Specialized Toolsetscited by 122
  7. 2024CyberSecEval 2: A Wide-Ranging Cybersecurity Evaluation Suite for Large Language Modelscited by 84
  8. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 52
  9. 2024HAICOSYSTEM: An Ecosystem for Sandboxing Safety Risks in Human-AI Interactionscited by 42

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 46; 2026: 41.

87 papers.

Sort:

By area:

  1. 2025ShieldAgent: Shielding Agents via Verifiable Safety Policy Reasoningcited by 144
  2. 2025A Survey on Trustworthy LLM Agents: Threats and Countermeasurescited by 93
  3. 2025CVE-Bench: A Benchmark for AI Agents' Ability to Exploit Real-World Web Application Vulnerabilitiescited by 90
  4. 2025A Survey of WebAgents: Towards Next-Generation AI Agents for Web Automation with Large Foundation Modelscited by 87
  5. 2025OpenAgentSafety: A Comprehensive Framework for Evaluating Real-World AI Agent Safetycited by 71
  6. 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMscited by 47
  7. 2025Vibe Coding vs. Agentic Coding: Fundamentals and Practical Implications of Agentic AIcited by 39
  8. 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 38
  9. 2026AgentLAB: Benchmarking LLM Agents against Long-Horizon Attackscited by 31
  10. 2025LLM Agents Should Employ Security Principlescited by 28
  11. 2025TAMAS: Benchmarking Adversarial Risks in Multi-Agent LLM Systemscited by 24
  12. 2025Frontier AI's Impact on the Cybersecurity Landscapecited by 21
38 more
  1. 2025PurpCode: Reasoning for Safer Code Generationcited by 17
  2. 2025Automatic Red Teaming LLM-based Agents with Model Context Protocol Toolscited by 17
  3. 2026AgentHazard: A Benchmark for Evaluating Harmful Behavior in Computer-Use Agentscited by 16
  4. 2025Training Language Model Agents to Find Vulnerabilities with CTF-Dojocited by 15
  5. 2025Think Twice Before You Act: Enhancing Agent Behavioral Safety with Thought Correctioncited by 14
  6. 2025When Refusals Fail: Unstable Safety Mechanisms in Long-Context LLM Agentscited by 13
  7. 2026Exploring Silicon-Based Societies: An Early Study of the Moltbook Agent Communitycited by 13
  8. 2025Software Development Life Cycle Perspective: A Survey of Benchmarks for Code Large Language Models and Agentscited by 11
  9. 2025Tapas Are Free! Training-Free Adaptation of Programmatic Agents via LLM-Guided Program Synthesis in Dynamic Environmentscited by 9
  10. 2025Unintended Misalignment from Agentic Fine-Tuning: Risks and Mitigationcited by 9
  11. 2025Web Fraud Attacks Against LLM-Driven Multi-Agent Systemscited by 8
  12. 2025Exposing Weak Links in Multi-Agent Systems under Adversarial Promptingcited by 8
  13. 2026AIR: Improving Agent Safety through Incident Responsecited by 8
  14. 2025When Developer Aid Becomes Security Debt: A Systematic Analysis of Insecure Behaviors in LLM Coding Agentscited by 7
  15. 2025Breaking the Code: Security Assessment of AI Code Agents Through Systematic Jailbreaking Attackscited by 7
  16. 2025Shadows in the Code: Exploring the Risks and Defenses of LLM-based Multi-Agent Software Development Systemscited by 7
  17. 2025Towards Evaluating Proactive Risk Awareness of Multimodal Language Modelscited by 6
  18. 2025Takedown: How It's Done in Modern Coding Agent Exploitscited by 6
  19. 2025PACEbench: A Framework for Evaluating Practical AI Cyber-Exploitation Capabilitiescited by 6
  20. 2026SEVerA: Verified Synthesis of Self-Evolving Agentscited by 6
  21. 2026Safeguarding LLM Agents against Long-Horizon Threats via Shadow Memorycited by 6
  22. 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
  23. 2025Achilles Heel of Distributed Multi-Agent Systemscited by 5
  24. 2025Enhancing LLM Agent Safety via Causal Influence Promptingcited by 5
  25. 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?cited by 5
  26. 2025STAC: When Innocent Tools Form Dangerous Chains for LLM Agentscited by 5
  27. 2025PEAR: Planner-Executor Agent Robustness Benchmarkcited by 5
  28. 2025CATArena: Evaluating Evolutionary Capabilities of Code Agents via Iterative Tournamentscited by 5
  29. 2026CIBER: A Comprehensive Benchmark for Security Evaluation of Code Interpreter Agentscited by 5
  30. 2026SABER: Benchmarking Operational Safety of LLM Coding Agents in Stateful Project Workspacescited by 5
  31. 2025Red-Teaming Coding Agents from a Tool-Invocation Perspective: An Empirical Security Assessmentcited by 4
  32. 2025QuadSentinel: Sequent Safety for Machine-Checkable Control in Multi-agent Systemscited by 4
  33. 2025With Great Capabilities Come Great Responsibilities: Introducing the Agentic Risk & Capability Framework for Governing Agentic AI Systemscited by 4
  34. 2025MCP Safety Training: Learning to Refuse Falsely Benign MCP Exploits using Improved Preference Alignmentcited by 3
  35. 2026From Tool Orchestration to Code Execution: A Study of MCP Design Choicescited by 3
  36. 2026Cross-Layer Semantic Flow Reconstruction for Attack Detection in Agentic Systemscited by 3
  37. 2026Backdoors in RLVR: Jailbreak Backdoors in LLMs From Verifiable Rewardcited by 3
  38. 2026Architecture Matters for Multi-Agent Securitycited by 3

50 most cited of 87 All 87 (JSON)

Similar, not cited

Close in wording, no citation either way

  1. 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents
  2. 2026Execution-Grounded Security Testing for Coding Agents in Software Engineering Pipelines
  3. 2026Towards a Risk Assessment of Malicious Skill Files in Coding Agents
  4. 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios
  5. 2026Code Broker: A Multi-Agent System for Automated Code Quality Assessment
  6. 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward
  7. 2026Beyond the Payload: How User Invocation Shapes Coding Agent Vulnerability to Repository Poisoning
  8. 2024CodeAgent: Enhancing Code Generation with Tool-Integrated Agent Systems for Real-World Repo-level Coding Challenges