RedCodeAgent: Automatic Red-teaming Agent against Code Agents
Abstract
LLM-based code agents, integrated with external tools like the Python interpreter, can interact with broad system environments and leverage code execution feedback to improve or self-debug generated code for better task-solving. However, as these code agents evolve rapidly in terms of capabilities, their increasing sophistication also amplifies security risks, such as generating or executing risky and buggy code. Traditional static safety benchmarks and manually designed red-teaming tools struggle to keep up with this rapid evolution, lacking the ability to adapt dynamically to the changing behaviors of code agents. To address these limitations, we propose RedCodeAgent, the first fully automated and adaptive red-teaming agent against given code agents. Equipped with red-teaming tools for function-calling and a novel memory module for accumulating successful attack experience, RedCodeAgent dynamically optimizes input prompts to jailbreak the target code agent for risky code execution. Unlike static benchmarks or red-teaming tools, RedCodeAgent autonomously adapts its attack strategies, making it a scalable solution to the growing challenge of testing increasingly sophisticated code agents. Experimental results show that compared to state-of-the-art LLM jailbreaking methods, RedCodeAgent achieves significantly higher attack success rates on the same tasks while maintaining high overall efficiency. By autonomously exploring and exploiting vulnerabilities of code agents, RedCodeAgent provides critical insights into the evolving security risks of code agents.
BibTeX
@misc{guo2025redcodeagent,
author = {Chengquan Guo and Chulin Xie and Yu Yang and Zinan Lin and Bo Li},
title = {{RedCodeAgent: Automatic Red-teaming Agent against Code Agents}},
year = {2025},
url = {https://openreview.net/forum?id=Mvn5g49RrM},
howpublished = {OpenReview},
note = {Submitted to ICLR 2025},
}Ask Althea to put this paper to the test.
Loading related content...