RedCoder: Automated Multi-Turn Red Teaming for Code LLMs
On the map: LLM safety and security → Prompt injection and agent security
Abstract (arXiv)
Large Language Models (LLMs) for code generation (i.e., Code LLMs) have demonstrated impressive capabilities in AI-assisted software development and testing. However, recent studies have shown that these models are prone to generating vulnerable or even malicious code under adversarial settings. Existing red-teaming approaches rely on extensive human effort, limiting their scalability and practicality, and generally overlook the interactive nature of real-world AI-assisted programming, which often unfolds over multiple turns. To bridge these gaps, we present RedCoder, a red-teaming agent that engages victim models in multi-turn conversation to elicit vulnerable code. The pipeline to construct RedCoder begins with a multi-agent gaming process that simulates adversarial interactions, yielding a set of prototype conversations and an arsenal of reusable attack strategies. We then fine-tune an LLM on these prototype conversations to serve as the backbone of RedCoder. Once deployed, RedCoder autonomously engages Code LLMs in multi-turn conversations, dynamically retrieving relevant strategies from the arsenal to steer the dialogue toward vulnerability-inducing outputs. Experiments across multiple Code LLMs show that our approach outperforms prior single-turn and multi-turn red-team methods in inducing vulnerabilities in code generation, offering a scalable and effective tool for evaluating the security boundaries of modern code-generation systems.
Key facts. Cited by 9 papers in the map (data through 14 Oct 2026). Placed in Prompt injection and agent security, one of 12 directions in LLM safety and security. Builds on 32 of its 50 references that are in the map. First posted on arXiv 25 Jun 2025.
Builds on
32 of 50 references.
Closest ancestors · 3
Same direction, newest first
- 2024Holistic Automated Red Teaming for Large Language Models through Top-Down Test Case Generation and Multi-turn Interaction25 Sep
- 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusal6 Feb
- 2023MART: Improving LLM Safety with Multi-round Automatic Red-Teaming13 Nov
Other references · 29
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,207
- 2024Qwen2.5-Coder Technical Reportcited by 1,203
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
- 2024Great, Now Write an Article About That: The Crescendo Multi-Turn LLM Jailbreak Attackcited by 390
- 2017Adversarial Attacks on Neural Network Policiescited by 320
- 2023The Impact of AI on Developer Productivity: Evidence from GitHub Copilotcited by 274
- 2023Using an LLM to Help With Code Understandingcited by 228
- 2024AutoDAN-Turbo: A Lifelong Agent for Strategy Self-Exploration to Jailbreak LLMscited by 199
17 more
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
- 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 152
- 2024CodeGemma: Open Code Models Based on Gemmacited by 150
- 2024Chain of Attack: a Semantic-Driven Contextual Multi-Turn attacker for LLMcited by 77
- 2024CodeAttack: Revealing Safety Generalization Challenges of Large Language Models via Code Completioncited by 76
- 2023TrojanPuzzle: Covertly Poisoning Code-Suggestion Modelscited by 60
- 2022CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Modelscited by 53
- 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attackscited by 33
- 2023DeceptPrompt: Exploiting LLM-driven Code Generation via Adversarial Natural Language Instructionscited by 33
- 2023Training-free Lexical Backdoor Attacks on Language Modelscited by 31
- 2025ThinkGuard: Deliberative Slow Thinking Leads to Cautious Guardrailscited by 31
- 2024What Makes Large Language Models Reason in (Multi-Turn) Code Generation?cited by 29
- 2025Multi-Turn Code Generation Through Single-Step Rewardscited by 28
- 2024Black-Box Adversarial Attacks on LLM-Based Code Completioncited by 14
- 2023Adversarial Attacks on Code Models with Discriminative Graph Patternscited by 6
- 2024Poisoning Programs by Un-Repairing Code: Security Concerns of AI-generated Codecited by 6
- 2024MaPPing Your Model: Assessing the Impact of Adversarial Attacks on LLM-based Programming Assistantscited by 5
Built on by
Citing papers per year: 2025: 3; 2026: 6.
9 papers.
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?cited by 3
- 2025ArenaBencher: Automatic Benchmark Evolution via Multi-Model Competitive Evaluationcited by 2
- 2026Adversarial Arena: Crowdsourcing Data Generation through Interactive Competitioncited by 1
- 2026SoK: Intent-Oriented Systematization of Multi-Turn LLM Jailbreakscited by 1
- 2025Amazon Nova AI Challenge -- Trusted AI: Advancing secure, AI-assisted software developmentcited by 0
- 2026DebugLM: Learning Traceable Training Data Provenance for LLMscited by 0
- 2026Refused in Chat, Written in Code: Workflow-Level Jailbreak Construction in IDE Coding Agentscited by 0
- 2026Code Monitor Red Teaming for Public-Test-Passing Codecited by 0
- 2026The Safeguard Worked. Is the LLM System Safer?cited by 0
- 2026The Safeguard Worked. Is the LLM System Safer?1 Sep 2026
- 2026SoK: Intent-Oriented Systematization of Multi-Turn LLM Jailbreaks2 Aug 2026
- 2026Code Monitor Red Teaming for Public-Test-Passing Code23 Jul 2026
- 2026Refused in Chat, Written in Code: Workflow-Level Jailbreak Construction in IDE Coding Agents4 Jul 2026
- 2026Adversarial Arena: Crowdsourcing Data Generation through Interactive Competition20 Apr 2026
- 2026DebugLM: Learning Traceable Training Data Provenance for LLMs18 Mar 2026
- 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?15 Oct 2025
- 2025ArenaBencher: Automatic Benchmark Evolution via Multi-Model Competitive Evaluation9 Oct 2025
- 2025Amazon Nova AI Challenge -- Trusted AI: Advancing secure, AI-assisted software development13 Aug 2025
Similar, not cited
Close in wording, no citation either way
- 2024Automated Red Teaming with GOAT: the Generative Offensive Agent Tester
- 2025Automatic LLM Red Teaming
- 2025RedTWIZ: Diverse LLM Red Teaming via Adaptive Attack Planning
- 2024Against The Achilles' Heel: A Survey on Red Teaming for Generative Models
- 2025BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AI
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents
- 2024Code-Switching Red-Teaming: LLM Evaluation for Safety and Multilingual Understanding
- 2025CoP: Agentic Red-teaming for Large Language Models using Composition of Principles