RedAgent: Red Teaming Large Language Models with Context-aware Autonomous Language Agent (2407.16667v1)
Abstract: Recently, advanced LLMs such as GPT-4 have been integrated into many real-world applications like Code Copilot. These applications have significantly expanded the attack surface of LLMs, exposing them to a variety of threats. Among them, jailbreak attacks that induce toxic responses through jailbreak prompts have raised critical safety concerns. To identify these threats, a growing number of red teaming approaches simulate potential adversarial scenarios by crafting jailbreak prompts to test the target LLM. However, existing red teaming methods do not consider the unique vulnerabilities of LLM in different scenarios, making it difficult to adjust the jailbreak prompts to find context-specific vulnerabilities. Meanwhile, these methods are limited to refining jailbreak templates using a few mutation operations, lacking the automation and scalability to adapt to different scenarios. To enable context-aware and efficient red teaming, we abstract and model existing attacks into a coherent concept called "jailbreak strategy" and propose a multi-agent LLM system named RedAgent that leverages these strategies to generate context-aware jailbreak prompts. By self-reflecting on contextual feedback in an additional memory buffer, RedAgent continuously learns how to leverage these strategies to achieve effective jailbreaks in specific contexts. Extensive experiments demonstrate that our system can jailbreak most black-box LLMs in just five queries, improving the efficiency of existing red teaming methods by two times. Additionally, RedAgent can jailbreak customized LLM applications more efficiently. By generating context-aware jailbreak prompts towards applications on GPTs, we discover 60 severe vulnerabilities of these real-world applications with only two queries per vulnerability. We have reported all found issues and communicated with OpenAI and Meta for bug fixes.
- J. Achiam, S. Adler, S. Agarwal, L. Ahmad, I. Akkaya, F. L. Aleman, D. Almeida, J. Altenschmidt, S. Altman, S. Anadkat et al., “Gpt-4 technical report,” arXiv preprint arXiv:2303.08774, 2023.
- AJ ONeal, “Chat GPT ”DAN” (and other ”Jailbreaks”),” https://gist.github.com/coolaj86/6f4f7b30129b0251f61fa7baaa881516, 2024, accessed: 2024-07-05.
- Amazon Web Services, “What are ai agents?” https://aws.amazon.com/what-is/ai-agents/?nc1=h_ls, 2024, accessed: 2024-07-05.
- C. Anil, E. Durmus, M. Sharma, J. Benton, S. Kundu, J. Batson, N. Rimsky, M. Tong, J. Mu, D. Ford et al., “Many-shot jailbreaking,” Anthropic, April, 2024.
- Anthropic, “Anthropic,” https://www.anthropic.com/, 2024, accessed: 2024-07-05.
- N. Botty, “Amazing ”jailbreak” bypasses chatgpt’s ethics safeguards,” 2023, accessed: 2024-07-03. [Online]. Available: https://futurism.com/amazing-jailbreak-chatgpt
- A. M. Bran, S. Cox, O. Schilter, C. Baldassari, A. D. White, and P. Schwaller, “Chemcrow: Augmenting large-language models with chemistry tools,” arXiv preprint arXiv:2304.05376, 2023.
- M. Burgess, “The hacking of chatgpt is just getting started,” Wired, 2023, accessed: 2024-07-03. [Online]. Available: https://www.wired.com/story/chatgpt-jailbreak-generative-ai-hacking/
- T. Cai, X. Wang, T. Ma, X. Chen, and D. Zhou, “Large language models as tool makers,” arXiv preprint arXiv:2305.17126, 2023.
- P. Chao, A. Robey, E. Dobriban, H. Hassani, G. J. Pappas, and E. Wong, “Jailbreaking black box large language models in twenty queries,” arXiv preprint arXiv:2310.08419, 2023.
- C. Crawl, “Common crawl maintains a free, open repository of web crawl data that can be used by anyone.” https://commoncrawl.org/, 2023, accessed: 2023-05-21.
- Y. Deng, W. Zhang, S. J. Pan, and L. Bing, “Multilingual jailbreak challenges in large language models,” arXiv preprint arXiv:2310.06474, 2023.
- A. Deshpande, V. Murahari, T. Rajpurohit, A. Kalyan, and K. Narasimhan, “Toxicity in chatgpt: Analyzing persona-assigned language models,” arXiv preprint arXiv:2304.05335, 2023.
- J. Gao, H. Zhao, C. Yu, and R. Xu, “Exploring the feasibility of chatgpt for event extraction,” arXiv preprint arXiv:2303.03836, 2023.
- GitHub, “Github copilot: Your ai pair programmer,” https://github.com/features/copilot, 2023, accessed: 2024-07-05.
- Google, “Bigquery – cloud data warehouse,” https://cloud.google.com/bigquery, 2024, accessed: 2024-05-21.
- Google DeepMind, “Google deepmind,” https://deepmind.google/, 2024, accessed: 2024-07-05.
- Grammarly, “To improve lives by improving communication,” https://www.grammarly.com/about, 2024, accessed: 2024-07-05.
- X. Guo, F. Yu, H. Zhang, L. Qin, and B. Hu, “Cold-attack: Jailbreaking llms with stealthiness and controllability,” arXiv preprint arXiv:2402.08679, 2024.
- M. Gupta, C. Akiri, K. Aryal, E. Parker, and L. Praharaj, “From chatgpt to threatgpt: Impact of generative ai in cybersecurity and privacy,” IEEE Access, 2023.
- A. Guzey, “A two sentence jailbreak for gpt-4 and claude & why nobody knows how to fix it,” https://guzey.com/ai/two-sentence-universal-jailbreak/, 2023, accessed: 2024-07-03.
- Jailbreak Chat, “Jailbreak chat,” https://www.jailbreakchat.com/, 2024, accessed: 2024-07-03.
- F. Jiang, Z. Xu, L. Niu, Z. Xiang, B. Ramasubramanian, B. Li, and R. Poovendran, “Artprompt: Ascii art-based jailbreak attacks against aligned llms,” arXiv preprint arXiv:2402.11753, 2024.
- R. Lapid, R. Langberg, and M. Sipper, “Open sesame! universal black box jailbreaking of large language models,” arXiv preprint arXiv:2309.01446, 2023.
- H. Li, D. Guo, W. Fan, M. Xu, J. Huang, F. Meng, and Y. Song, “Multi-step jailbreaking privacy attacks on chatgpt,” arXiv preprint arXiv:2304.05197, 2023.
- X. Li, R. Wang, M. Cheng, T. Zhou, and C.-J. Hsieh, “Drattack: Prompt decomposition and reconstruction makes powerful llm jailbreakers,” arXiv preprint arXiv:2402.16914, 2024.
- X. Li, Z. Zhou, J. Zhu, J. Yao, T. Liu, and B. Han, “Deepinception: Hypnotize large language model to be jailbreaker,” arXiv preprint arXiv:2311.03191, 2023.
- T. Liu, Y. Zhang, Z. Zhao, Y. Dong, G. Meng, and K. Chen, “Making them ask and answer: Jailbreaking large language models in few queries via disguise and reconstruction,” arXiv preprint arXiv:2402.18104, 2024.
- X. Liu, N. Xu, M. Chen, and C. Xiao, “Autodan: Generating stealthy jailbreak prompts on aligned large language models,” arXiv preprint arXiv:2310.04451, 2023.
- Y. Liu, G. Deng, Z. Xu, Y. Li, Y. Zheng, Y. Zhang, L. Zhao, T. Zhang, K. Wang, and Y. Liu, “Jailbreaking chatgpt via prompt engineering: An empirical study,” arXiv preprint arXiv:2305.13860, 2023.
- A. Mehrotra, M. Zampetakis, P. Kassianik, B. Nelson, H. Anderson, Y. Singer, and A. Karbasi, “Tree of attacks: Jailbreaking black-box llms automatically,” arXiv preprint arXiv:2312.02119, 2023.
- MicroSoft, “Introducing the new bing. the ai-powered assistant for your search.” https://www.microsoft.com/en-us/edge/features/the-new-bing?form=MA13FJ, 2024, accessed: 2024-07-05.
- Z. Mowshowitz, “Jailbreaking the chatgpt on release,” https://thezvi.substack.com/p/jailbreaking-the-chatgpt-on-release, 2023, accessed: 2024-07-03.
- A. Newell, J. C. Shaw, and H. A. Simon, “The processes of creative thinking.” in Contemporary Approaches to Creative Thinking, 1958, University of Colorado, CO, US; This paper was presented at the aforementioned symposium. Atherton Press, 1962.
- E. Nijkamp, B. Pang, H. Hayashi, L. Tu, H. Wang, Y. Zhou, S. Savarese, and C. Xiong, “Codegen: An open large language model for code with multi-turn program synthesis,” arXiv preprint arXiv:2203.13474, 2022.
- OpenAI, “Introducing gpts,” https://openai.com/index/introducing-gpts/, 2023, accessed: 2024-07-05.
- ——, “Openai,” https://openai.com/, 2024, accessed: 2024-07-05.
- L. Ouyang, J. Wu, X. Jiang, D. Almeida, C. Wainwright, P. Mishkin, C. Zhang, S. Agarwal, K. Slama, A. Ray et al., “Training language models to follow instructions with human feedback,” Advances in neural information processing systems, vol. 35, pp. 27 730–27 744, 2022.
- OWASP, “Owasp top 10 for large language model applications,” https://owasp.org/www-project-top-10-for-large-language-model-applications/, 2023, accessed: 2024-07-05.
- J. S. Park, J. O’Brien, C. J. Cai, M. R. Morris, P. Liang, and M. S. Bernstein, “Generative agents: Interactive simulacra of human behavior,” in Proceedings of the 36th annual acm symposium on user interface software and technology, 2023, pp. 1–22.
- pulsr.co.uk, “math,” https://chatgpt.com/g/g-odWlfAKWM-math, 2024, accessed: 2024-07-05.
- X. Qi, Y. Zeng, T. Xie, P.-Y. Chen, R. Jia, P. Mittal, and P. Henderson, “Fine-tuning aligned language models compromises safety, even when users do not intend to!” arXiv preprint arXiv:2310.03693, 2023.
- Reddit, “Dive into anything,” https://www.reddit.com/, 2024, accessed: 2024-07-05.
- Sakil, “sentence_similarity_semantic_search,” https://huggingface.co/Sakil/sentence_similarity_semantic_search, 2023, accessed: 2024-07-05.
- T. Schick, J. Dwivedi-Yu, R. Dessì, R. Raileanu, M. Lomeli, E. Hambro, L. Zettlemoyer, N. Cancedda, and T. Scialom, “Toolformer: Language models can teach themselves to use tools,” Advances in Neural Information Processing Systems, vol. 36, 2024.
- X. Shen, Z. Chen, M. Backes, Y. Shen, and Y. Zhang, “” do anything now”: Characterizing and evaluating in-the-wild jailbreak prompts on large language models,” arXiv preprint arXiv:2308.03825, 2023.
- N. Shinn, F. Cassano, A. Gopinath, K. Narasimhan, and S. Yao, “Reflexion: Language agents with verbal reinforcement learning,” Advances in Neural Information Processing Systems, vol. 36, 2024.
- Sora, “Generator text to video maker,” https://chatgpt.com/g/g-CPgdui5Ib-generator-text-to-video-maker, 2024, accessed: 2024-07-05.
- Z. Switten, “Twitter post,” https://x.com/zswitten/status/1598380220943593472?lang=en, 2022, accessed: 2024-07-03.
- G. Team, R. Anil, S. Borgeaud, Y. Wu, J.-B. Alayrac, J. Yu, R. Soricut, J. Schalkwyk, A. M. Dai, A. Hauth et al., “Gemini: a family of highly capable multimodal models,” arXiv preprint arXiv:2312.11805, 2023.
- Walkspider, “Dan is my new friend,” https://www.reddit.com/r/ChatGPT/comments/zlcyr9/dan_is_my_new_friend/?rdt=64914, 2022, accessed: 2024-07-03.
- G. Wang, Y. Xie, Y. Jiang, A. Mandlekar, C. Xiao, Y. Zhu, L. Fan, and A. Anandkumar, “Voyager: An open-ended embodied agent with large language models,” arXiv preprint arXiv:2305.16291, 2023.
- L. Wang, J. Zhang, X. Chen, Y. Lin, R. Song, W. X. Zhao, and J.-R. Wen, “Recagent: A novel simulation paradigm for recommender systems,” arXiv preprint arXiv:2306.02552, 2023.
- A. Wei, N. Haghtalab, and J. Steinhardt, “Jailbroken: How does llm safety training fail?” Advances in Neural Information Processing Systems, vol. 36, 2024.
- J. Wei, X. Wang, D. Schuurmans, M. Bosma, F. Xia, E. Chi, Q. V. Le, D. Zhou et al., “Chain-of-thought prompting elicits reasoning in large language models,” Advances in neural information processing systems, vol. 35, pp. 24 824–24 837, 2022.
- Wikipedia, “Wikipedia:database download,” https://en.wikipedia.org/wiki/Wikipedia:Database_download, 2024, accessed: 2024-07-05.
- S. Yao, D. Yu, J. Zhao, I. Shafran, T. Griffiths, Y. Cao, and K. Narasimhan, “Tree of thoughts: Deliberate problem solving with large language models,” Advances in Neural Information Processing Systems, vol. 36, 2024.
- S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. Narasimhan, and Y. Cao, “React: Synergizing reasoning and acting in language models,” arXiv preprint arXiv:2210.03629, 2022.
- Z.-X. Yong, C. Menghini, and S. H. Bach, “Low-resource languages jailbreak gpt-4,” arXiv preprint arXiv:2310.02446, 2023.
- J. Yu, X. Lin, and X. Xing, “Gptfuzzer: Red teaming large language models with auto-generated jailbreak prompts,” arXiv preprint arXiv:2309.10253, 2023.
- Z. Yu, X. Liu, S. Liang, Z. Cameron, C. Xiao, and N. Zhang, “Don’t listen to me: Understanding and exploring jailbreak prompts of large language models,” arXiv preprint arXiv:2403.17336, 2024.
- Y. Zeng, H. Lin, J. Zhang, D. Yang, R. Jia, and W. Shi, “How johnny can persuade llms to jailbreak them: Rethinking persuasion to challenge ai safety by humanizing llms,” arXiv preprint arXiv:2401.06373, 2024.
- T. Zhang, F. Ladhak, E. Durmus, P. Liang, K. McKeown, and T. B. Hashimoto, “Benchmarking large language models for news summarization,” Transactions of the Association for Computational Linguistics, vol. 12, pp. 39–57, 2024.
- Y. Zhu, R. Kiros, R. Zemel, R. Salakhutdinov, R. Urtasun, A. Torralba, and S. Fidler, “Aligning books and movies: Towards story-like visual explanations by watching movies and reading books,” in Proceedings of the IEEE international conference on computer vision, 2015, pp. 19–27.
- A. Zou, Z. Wang, J. Z. Kolter, and M. Fredrikson, “Universal and transferable adversarial attacks on aligned language models,” arXiv preprint arXiv:2307.15043, 2023.
- Huiyu Xu (5 papers)
- Wenhui Zhang (22 papers)
- ZhiBo Wang (48 papers)
- Feng Xiao (68 papers)
- Rui Zheng (79 papers)
- Yunhe Feng (21 papers)
- Zhongjie Ba (22 papers)
- Kui Ren (169 papers)