EvilPromptFuzzer: generating inappropriate content based on text-to-image models

Juntao He, Haoran Dai, Runqi Sui, Xuejing Yuan, Dun Liu, Hao Feng, Xinyue Liu, Wenchuan Yang, Baojiang Cui, Kedan LiCybersecur 2024

Abstract

As Text-to-Image (TTI) models become increasingly integrated into digital workflows, ensuring their safety against the generation of harmful content is paramount. Current defenses primarily utilize keyword-based filters and simple image classifiers. This paper presents EvilPromptFuzzer, a systematic framework that leverages Large Language Models (LLMs) to expose vulnerabilities in TTI models. By employing a technique termed "semantic dilution," the framework crafts complex, descriptive prompts that mask malicious intent, successfully bypassing safety filters in models like DALL-E 3. Our findings reveal that certain risk categories, such as political extremism, can achieve generation success rates as high as 71%, underscoring a critical gap in existing content moderation strategies.

Introduction

Generative AI has seen a surge in popularity with the advent of TTI models like DALL-E 3, Midjourney, and Stable Diffusion. To mitigate the risk of generating harmful imagery, these models incorporate safety "guardrails." However, these defenses face two primary challenges:

  1. Protective Mechanisms (C1): Models often block specific "threatening tokens" (e.g., "gun," "blood"), which can be circumvented by alternative phrasing.
  2. Black-box Complexity (C2): The internal logic of these models is opaque, making it difficult for human red-teamers to manually craft diverse prompts that consistently bypass filters while maintaining the intended "evil" context.

EvilPromptFuzzer addresses these challenges by automating the prompt engineering process using an auxiliary LLM to probe and exploit the target model's weaknesses.

Methodology: The Fuzzing Framework

EvilPromptFuzzer operates through a two-stage process: initialization and construction.

Initialization

The framework first uses an auxiliary LLM (e.g., ChatGPT) to probe the target TTI model. It identifies "seed types"—combinations of characters, actions, and locations—and "sensitive words" that trigger the model's filters. These are stored in a Sensitive Words Vector to guide subsequent prompt generation.

Prompt Construction and Semantic Dilution

The core innovation of EvilPromptFuzzer is the semantic dilution technique. Instead of using forbidden keywords, the tool instructs an LLM to build a long, descriptive scene (typically 30–120 words) that implies the risk through context. For instance, instead of using the word "blood," the prompt might describe "splashes of thick red ink on a cold floor." This approach dilutes the malicious signal among many benign words, allowing the prompt to pass through the auditor.

The EvilPromptFuzzer construction pipeline, illustrating the feedback loop between the TTI model and the prompt generation engine.

The system also incorporates a feedback loop. If a prompt is rejected, the system identifies the likely offending words, updates the sensitive list, and regenerates a more "diluted" version of the scene.

Risk Taxonomy and Datasets

The study evaluates the framework across a broad spectrum of inappropriate content. The authors constructed a Seed Matrix covering 15 fine-grained risks categorized under five major headers: Violence, Disturbing, Hateful (Bias), Political, and Sexually Explicit.

Taxonomy of risks and fine-grained categories used to evaluate the EvilPromptFuzzer framework.

To validate the results, the authors generated approximately 2,500 images and conducted a human study with 12 participants to verify if the generated imagery accurately reflected the intended inappropriate content.

Key Results and Insights

EvilPromptFuzzer demonstrated significant efficacy in bypassing commercial safety filters:

  • High Success Rates: On DALL-E 3, the success rate for generating inappropriate images exceeded 30% for most categories.
  • Vulnerable Categories: Efficiency was notably high for Political Symbols (71%), Disgusting content (64%), and Horrible imagery (58%).
  • Comparative Performance: In head-to-head tests, EvilPromptFuzzer achieved a 41% success rate across violent, disturbing, and political risks, significantly outperforming previous methods like Unsafe Diffusion, which reached only 12%.

Furthermore, the study tested the generated "evil" images against industry-standard moderation platforms (Amazon Rekognition, Google SafeSearch, Azure AI, and Baidu). The results were startling: Google identified only 33.85% of the malicious images, while Azure caught a mere 2.34%.

Conclusion

The success of EvilPromptFuzzer highlights a fundamental weakness in current TTI safety mechanisms: they are much better at catching "what" is said (keywords) than "what is meant" (context). While models like DALL-E 3 show higher resistance to sexual content, they remain highly vulnerable to context-based attacks in other domains. Future research must focus on developing context-aware image detectors capable of seeing through the "diluted" prompts that LLMs can now effortlessly generate.

Summary updated

BibTeX
@article{he2024evilpromptfuzzer,
  author = {Juntao He and Haoran Dai and Runqi Sui and Xuejing Yuan and Dun Liu and Hao Feng and Xinyue Liu and Wenchuan Yang and Baojiang Cui and Kedan Li},
  title = {{EvilPromptFuzzer: generating inappropriate content based on text-to-image models}},
  journal = {Cybersecur.},
  year = {2024},
  doi = {10.1186/s42400-024-00279-9},
}
Figure