Abstract
Jailbreaking is an emerging adversarial attack that bypasses the safety alignment deployed in off-the-shelf large language models (LLMs) and has evolved into multiple categories: human-based, optimization-based, generation-based, and the recent indirect and multilingual jailbreaks. However, delivering a practical jailbreak defense is challenging because it needs to not only handle all the above jailbreak attacks but also incur negligible delays to user prompts, as well as be compatible with both open-source and closed-source LLMs. Inspired by how the traditional security concept of shadow stacks defends against memory overflow attacks, this paper introduces a generic LLM jailbreak defense framework called SELFDEFEND, which establishes a shadow LLM as a defense instance (in detection state) to concurrently protect the target LLM instance (in normal answering state) in the normal stack and collaborate with it for checkpoint-based access control. The effectiveness of SELFDEFEND builds upon our observation that existing LLMs can identify harmful prompts or intentions in user queries, which we empirically validate using mainstream GPT-3.5/4 models against major jailbreak attacks. To further improve the defense’s robustness and minimize costs, we employ a data distillation approach to tune dedicated open-source defense models. When deployed to protect GPT-3.5/4, Claude, Llama-2-7b/13b, and Mistral, these models outperform seven state-of-the-art defenses and match the performance of GPT-4-based SELFDEFEND, with significantly lower extra delays. Further experiments show that the tuned models are robust to adaptive jailbreaks and prompt injections.
| Original language | English |
|---|---|
| Title of host publication | Proceedings of the 34th USENIX Security Symposium |
| Publisher | USENIX Association |
| Pages | 2441-2460 |
| Number of pages | 20 |
| ISBN (Electronic) | 9781939133526 |
| Publication status | Published - 2025 |
| Externally published | Yes |
| Event | 34th USENIX Security Symposium, USENIX Security 2025 - Seattle, United States Duration: 13 Aug 2025 → 15 Aug 2025 |
Conference
| Conference | 34th USENIX Security Symposium, USENIX Security 2025 |
|---|---|
| Country/Territory | United States |
| City | Seattle |
| Period | 13/08/25 → 15/08/25 |
Bibliographical note
Publisher Copyright:© 2025 by The USENIX Association All Rights Reserved.
Funding
We thank the reviewers and the shepherd for their constructive comments. The HKUST authors are supported in part by an RGC CRF grant under contract C6015-23G, a research fund provided by HSBC, and a UGC TLIP project (175X-2425). The NTU authors are supported by the National Research Foundation, Singapore, and the Cyber Security Agency under its National Cybersecurity R&D Programme (NCRP25-P04-TAICeN), the National Research Foundation, Singapore, and DSO National Laboratories under the AI Singapore Programme (AISG Award No: AISG2GC-2023-008), and NRF Investigatorship NRF-NRFI06-20200001. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not reflect the views of National Research Foundation, Singapore and Cyber Security Agency of Singapore.
Fingerprint
Dive into the research topics of 'SELFDEFEND: LLMs Can Defend Themselves against Jailbreaking in a Practical Manner'. Together they form a unique fingerprint.Cite this
- APA
- Author
- BIBTEX
- Harvard
- Standard
- RIS
- Vancouver