mlsanityData to 14 Oct 2026

RedCoder: Automated Multi-Turn Red Teaming for Code LLMs

arXiv 2507.22063 ↗First posted 25 Jun 2025cs.SE cs.AIcited by 9

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

  1. 2024Holistic Automated Red Teaming for Large Language Models through Top-Down Test Case Generation and Multi-turn Interaction25 Sep
  2. 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusal6 Feb
  3. 2023MART: Improving LLM Safety with Multi-round Automatic Red-Teaming13 Nov

Other references · 29

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
  3. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  4. 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,207
  5. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  6. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
  7. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  8. 2024Great, Now Write an Article About That: The Crescendo Multi-Turn LLM Jailbreak Attackcited by 390
  9. 2017Adversarial Attacks on Neural Network Policiescited by 320
  10. 2023The Impact of AI on Developer Productivity: Evidence from GitHub Copilotcited by 274
  11. 2023Using an LLM to Help With Code Understandingcited by 228
  12. 2024AutoDAN-Turbo: A Lifelong Agent for Strategy Self-Exploration to Jailbreak LLMscited by 199
17 more
  1. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
  2. 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 152
  3. 2024CodeGemma: Open Code Models Based on Gemmacited by 150
  4. 2024Chain of Attack: a Semantic-Driven Contextual Multi-Turn attacker for LLMcited by 77
  5. 2024CodeAttack: Revealing Safety Generalization Challenges of Large Language Models via Code Completioncited by 76
  6. 2023TrojanPuzzle: Covertly Poisoning Code-Suggestion Modelscited by 60
  7. 2022CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Modelscited by 53
  8. 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attackscited by 33
  9. 2023DeceptPrompt: Exploiting LLM-driven Code Generation via Adversarial Natural Language Instructionscited by 33
  10. 2023Training-free Lexical Backdoor Attacks on Language Modelscited by 31
  11. 2025ThinkGuard: Deliberative Slow Thinking Leads to Cautious Guardrailscited by 31
  12. 2024What Makes Large Language Models Reason in (Multi-Turn) Code Generation?cited by 29
  13. 2025Multi-Turn Code Generation Through Single-Step Rewardscited by 28
  14. 2024Black-Box Adversarial Attacks on LLM-Based Code Completioncited by 14
  15. 2023Adversarial Attacks on Code Models with Discriminative Graph Patternscited by 6
  16. 2024Poisoning Programs by Un-Repairing Code: Security Concerns of AI-generated Codecited by 6
  17. 2024MaPPing Your Model: Assessing the Impact of Adversarial Attacks on LLM-based Programming Assistantscited by 5

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 3; 2026: 6.

9 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2024Automated Red Teaming with GOAT: the Generative Offensive Agent Tester
  2. 2025Automatic LLM Red Teaming
  3. 2025RedTWIZ: Diverse LLM Red Teaming via Adaptive Attack Planning
  4. 2024Against The Achilles' Heel: A Survey on Red Teaming for Generative Models
  5. 2025BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AI
  6. 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents
  7. 2024Code-Switching Red-Teaming: LLM Evaluation for Safety and Multilingual Understanding
  8. 2025CoP: Agentic Red-teaming for Large Language Models using Composition of Principles