Defense Against Prompt Injection Attack by Leveraging Attack Techniques

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Chen, Yulin, Li, Haoran, Zheng, Zihao, Song, Yangqiu, Wu, Dekai, Hooi, Bryan
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866913970440372224
author Chen, Yulin
Li, Haoran
Zheng, Zihao
Song, Yangqiu
Wu, Dekai
Hooi, Bryan
author_facet Chen, Yulin
Li, Haoran
Zheng, Zihao
Song, Yangqiu
Wu, Dekai
Hooi, Bryan
contents With the advancement of technology, large language models (LLMs) have achieved remarkable performance across various natural language processing (NLP) tasks, powering LLM-integrated applications like Microsoft Copilot. However, as LLMs continue to evolve, new vulnerabilities, especially prompt injection attacks arise. These attacks trick LLMs into deviating from the original input instructions and executing the attacker's instructions injected in data content, such as retrieved results. Recent attack methods leverage LLMs' instruction-following abilities and their inabilities to distinguish instructions injected in the data content, and achieve a high attack success rate (ASR). When comparing the attack and defense methods, we interestingly find that they share similar design goals, of inducing the model to ignore unwanted instructions and instead to execute wanted instructions. Therefore, we raise an intuitive question: Could these attack techniques be utilized for defensive purposes? In this paper, we invert the intention of prompt injection methods to develop novel defense methods based on previous training-free attack methods, by repeating the attack process but with the original input instruction rather than the injected instruction. Our comprehensive experiments demonstrate that our defense techniques outperform existing training-free defense approaches, achieving state-of-the-art results.
format Preprint
id arxiv_https___arxiv_org_abs_2411_00459
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Defense Against Prompt Injection Attack by Leveraging Attack Techniques
Chen, Yulin
Li, Haoran
Zheng, Zihao
Song, Yangqiu
Wu, Dekai
Hooi, Bryan
Cryptography and Security
With the advancement of technology, large language models (LLMs) have achieved remarkable performance across various natural language processing (NLP) tasks, powering LLM-integrated applications like Microsoft Copilot. However, as LLMs continue to evolve, new vulnerabilities, especially prompt injection attacks arise. These attacks trick LLMs into deviating from the original input instructions and executing the attacker's instructions injected in data content, such as retrieved results. Recent attack methods leverage LLMs' instruction-following abilities and their inabilities to distinguish instructions injected in the data content, and achieve a high attack success rate (ASR). When comparing the attack and defense methods, we interestingly find that they share similar design goals, of inducing the model to ignore unwanted instructions and instead to execute wanted instructions. Therefore, we raise an intuitive question: Could these attack techniques be utilized for defensive purposes? In this paper, we invert the intention of prompt injection methods to develop novel defense methods based on previous training-free attack methods, by repeating the attack process but with the original input instruction rather than the injected instruction. Our comprehensive experiments demonstrate that our defense techniques outperform existing training-free defense approaches, achieving state-of-the-art results.
title Defense Against Prompt Injection Attack by Leveraging Attack Techniques
topic Cryptography and Security
url https://arxiv.org/abs/2411.00459