May I have your Attention? Breaking Fine-Tuning based Prompt Injection Defenses using Architecture-Aware Attacks

Nishit V. Pandya, Andrey Labunets, Sicun Gao, Earlence Fernandes
7/10/2025
cs.CRcs.AIcs.CL

Official code: nishitvp/better_opts_attacks (11 stars, MIT, last commit 2026-04-30).

Abstract

A popular class of defenses against prompt injection attacks on large language models (LLMs) relies on fine-tuning to separate instructions and data, so that the LLM does not follow instructions that might be present with data. We evaluate the robustness of this approach in the whitebox setting by constructing strong optimization-based attacks, and show that the defenses do not provide the claimed security properties. Specifically, we construct a novel attention-based attack algorithm for textual LLMs and apply it to three recent whitebox defenses SecAlign (CCS 2025), SecAlign++, and StruQ (USENIX Security 2025), showing attacks with success rates of up to \textbf{85-95\%} on unseen prompts with modest increase in attacker budget in terms of tokens. Our findings make fundamental progress towards understanding the robustness of prompt injection defenses in the whitebox setting. We release our code and attacks at https://github.com/nishitvp/better_opts_attacks

View on arXivView PDF

Code Implementations(1)

MIT
113Shell, PythonDec 13, 20245 months agoMIT

Similar Papers

Cite this paper

@article{pandya2025have,
  title  = {May I have your Attention? Breaking Fine-Tuning based Prompt Injection Defenses using Architecture-Aware Attacks},
  author = {Nishit V. Pandya and Andrey Labunets and Sicun Gao and Earlence Fernandes},
  year   = {2025},
  eprint = {2507.07417},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.07417v2}
}

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/2507.07417.svg)](https://codeofpaper.com/paper/2507.07417)

Discussion