Keywords: Trustworthy machine learning, Code Agents, LLM
TL;DR: We propose an 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.
Supplementary Material: zip
Primary Area: alignment, fairness, safety, privacy, and societal considerations
Code Of Ethics: I acknowledge that I and all co-authors of this work have read and commit to adhering to the ICLR Code of Ethics.
Submission Guidelines: I certify that this submission complies with the submission instructions as described on https://iclr.cc/Conferences/2025/AuthorGuide.
Reciprocal Reviewing: I understand the reciprocal reviewing requirement as described on https://iclr.cc/Conferences/2025/CallForPapers. If none of the authors are registered as a reviewer, it may result in a desk rejection at the discretion of the program chairs. To request an exception, please complete this form at https://forms.gle/Huojr6VjkFxiQsUp6.
Anonymous Url: I certify that there is no URL (e.g., github page) that could be used to find authors’ identity.
No Acknowledgement Section: I certify that there is no acknowledgement section in this submission for double blind review.
Submission Number: 12901
Loading