Hacking Back the AI-Hacker: Prompt Injection as a Defense Against LLM-driven Cyberattacks

Dario Pasquini, Evgenios M. Kornaropoulos, Giuseppe Ateniese
10/28/2024
cs.CRcs.AI

Official code: pasquini-dario/project_mantis (119 stars, last commit 2025-05-26).

Abstract

Large language models (LLMs) are increasingly being harnessed to automate cyberattacks, making sophisticated exploits more accessible and scalable. In response, we propose a new defense strategy tailored to counter LLM-driven cyberattacks. We introduce Mantis, a defensive framework that exploits LLMs' susceptibility to adversarial inputs to undermine malicious operations. Upon detecting an automated cyberattack, Mantis plants carefully crafted inputs into system responses, leading the attacker's LLM to disrupt their own operations (passive defense) or even compromise the attacker's machine (active defense). By deploying purposefully vulnerable decoy services to attract the attacker and using dynamic prompt injections for the attacker's LLM, Mantis can autonomously hack back the attacker. In our experiments, Mantis consistently achieved over 95% effectiveness against automated LLM-driven attacks. To foster further research and collaboration, Mantis is available as an open-source tool: https://github.com/pasquini-dario/project_mantis

View on arXivView PDF

Code Implementations(1)

Project Mantis: Hacking Back the AI-Hacker; Prompt Injection as a Defense Against LLM-driven Cyberattacks

11913PythonOct 24, 20241 years ago
cybersecurityllmsprompt-injection

Similar Papers

Cite this paper

@article{pasquini2024hacking,
  title  = {Hacking Back the AI-Hacker: Prompt Injection as a Defense Against LLM-driven Cyberattacks},
  author = {Dario Pasquini and Evgenios M. Kornaropoulos and Giuseppe Ateniese},
  year   = {2024},
  eprint = {2410.20911},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.20911v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.20911.svg)](https://codeofpaper.com/paper/2410.20911)

Discussion