PROMPTFUZZ: Harnessing Fuzzing Techniques for Robust Testing of Prompt Injection in LLMs

Jiahao Yu, Yangguang Shao, Hanwen Miao, Junzheng Shi, Xinyu XingIEEE Trans. IFS 2024 · DOI · OpenReview

Introduction

As Large Language Models (LLMs) transition from simple chatbots to autonomous agents integrated into complex applications, they face a critical security threat: prompt injection. This vulnerability occurs when malicious user input overrides a developer's system instructions, leading the model to perform unauthorized actions, such as leaking sensitive configurations or ignoring safety guardrails.

Examples of prompt injection categories and successful attacks.

Current testing methods rely heavily on manual "red-teaming," which is costly, slow, and difficult to scale. Existing automated tools often require "white-box" access to model weights or are limited to narrow attack vectors. PROMPTFUZZ addresses these gaps by providing a scalable, automated, black-box fuzzing framework designed to systematically uncover vulnerabilities across diverse scenarios.

Methodology: Evolutionary Semantic Fuzzing

PROMPTFUZZ adapts classic software fuzzing principles—Seed Initialization, Selection, Mutation, Execution, and Evaluation—to the linguistic domain of LLMs. The framework operates in two primary stages:

The two-stage PROMPTFUZZ framework architecture.
  1. Preparation Phase: The system initializes a pool of human-written attack "seeds." These seeds undergo various mutations (e.g., rephrasing, expansion, or crossover) and are tested against validation defenses to identify the most effective strategies.
  2. Focus Phase: The fuzzer concentrates its query budget on high-performing seeds. It employs a Seed Selector based on a tree-search algorithm (Upper Confidence Bound) to balance the exploration of new variations with the exploitation of known successful prompts.
  3. LLM-as-a-Mutator: Unlike traditional bit-flipping, PROMPTFUZZ utilizes a separate LLM (e.g., GPT-3.5) to perform semantic mutations. By using "few-shot" examples of successful attacks, the system guides the mutation process toward more sophisticated linguistic strategies.
  4. Early Termination: To optimize API costs, the system dynamically halts the testing of a mutant if it fails against initial, simpler defenses.

Datasets and Evaluation

The framework was evaluated using several benchmarks:

  • TensorTrust: A large-scale benchmark for prompt injection focusing on message extraction (stealing secret codes) and output hijacking (forcing specific model outputs).
  • Custom Fine-tuning Dataset: The authors open-sourced 1,940 samples across six categories to aid in training more robust models.
  • Real-world Applications: Testing was conducted on popular "GPTs" from the OpenAI and Coze stores.

Key Results and Insights

PROMPTFUZZ demonstrated remarkable efficacy in both controlled and real-world settings:

  • Competitive Performance: In the TensorTrust competition, PROMPTFUZZ secured a 7th place ranking out of over 4,000 participants within just two hours of execution.
  • Benchmark Dominance: On the TensorTrust dataset, the framework achieved success rates of 64.9% for message extraction and 75.33% for output hijacking, significantly outperforming human expert baselines (6.7% and 19.33%, respectively).
  • The Power of Evolution: A key finding is that even "weak" initial seeds with 0% success rates can be evolved into highly effective attacks through iterative mutation.
  • Real-world Fragility: The study found that 65% of popular real-world LLM applications were vulnerable to system prompt leakage when challenged by evolved prompts.

Conclusion and Future Work

While PROMPTFUZZ offers a powerful tool for robustness testing, it faces challenges regarding query costs and the current focus on text-based attacks. Future research will explore multi-modal injections (images/audio) and multi-turn conversational attacks. As defenses become more adaptive, mutation strategies must also evolve to remain stealthy and effective.

Summary updated

BibTeX
@article{yu2024promptfuzz,
  author = {Jiahao Yu and Yangguang Shao and Hanwen Miao and Junzheng Shi and Xinyu Xing},
  title = {{PROMPTFUZZ: Harnessing Fuzzing Techniques for Robust Testing of Prompt Injection in LLMs}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2024},
  doi = {10.1109/tifs.2026.3666893},
}
Figure