On the Proactive Generation of Unsafe Images From Text-To-Image Models Using Benign Prompts

Yixin Wu, Ning Yu, Michael Backes, Yun Shen, Yang Zhang · OpenReview

Abstract

Text-to-image models like Stable Diffusion have had a profound impact on daily life by enabling the generation of photorealistic images from textual prompts, fostering creativity, and enhancing visual experiences across various applications. However, these models also pose risks. Previous studies have successfully demonstrated that manipulated prompts can elicit text-to-image models to generate unsafe images, e.g., hateful meme variants. Yet, these studies only unleash the harmful power of text-to-image models in a passive manner. In this work, we focus on the proactive generation of unsafe images using targeted benign prompts via poisoning attacks. We propose two poisoning attacks: a basic attack and a utility-preserving attack. We qualitatively and quantitatively evaluate the proposed attacks using four representative hateful memes and multiple query prompts. Experimental results indicate that text-to-image models are vulnerable to the basic attack even with five poisoning samples. However, the poisoning effect can inadvertently spread to non-targeted prompts, leading to undesirable side effects. Root cause analysis identifies conceptual similarity as an important contributing factor to the side effects. To address this, we introduce the utility-preserving attack as a viable mitigation strategy to maintain the attack stealthiness, while ensuring decent attack performance. Our findings underscore the potential risks of adopting text-to-image models in real-world scenarios, calling for future research and safety measures in this space.

Introduction

Text-to-image (T2I) models like Stable Diffusion have revolutionized content creation, but their safety remains a critical concern. Most existing research focuses on passive exploitation, where malicious users attempt to bypass safety filters using "jailbreak" prompts. This paper investigates a more insidious threat: proactive generation.

In this scenario, an adversary—such as a malicious model provider or a compromised third-party fine-tuning service—poisons the model's weights. This allows seemingly innocent, benign prompts (e.g., "a photo of a cat") to trigger the generation of hateful memes or unsafe content. Because the input prompts are benign, they easily bypass standard input-side safety filters.

Attack Methodology

The core of the proactive attack lies in fine-tuning a base model on a small, poisoned dataset. The adversary maps a benign target prompt to a set of unsafe images retrieved from sources like 4chan.

Overview of the proactive poisoning attack pipeline.

The researchers propose three levels of attack sophistication:

  1. Basic Poisoning: Fine-tuning the model on a small set of (benign prompt, unsafe image) pairs.
  2. Utility-Preserving (Stealthy) Poisoning: To prevent the attack from being detected via statistical anomalies or "side effects" (where poisoning "cat" accidentally affects "dog"), the authors include "sanitizing" samples of related concepts to keep them clean.
  3. Shortcut Prompt Extraction: By using image-captioning tools like BLIP, attackers can identify "shortcut" concepts that are visually closer to the target unsafe image. This allows the attack to succeed with as few as five poisoning samples.

Experimental Setup

The study evaluated the attacks using four notorious hateful memes: Pepe the Frog, Happy Merchant, Porky, and Sheeeit. These memes are particularly challenging for automated systems because their harm is often context-dependent and targeted at specific communities.

Representative hateful memes used in the study: Pepe the Frog, Happy Merchant, Porky, and Sheeeit.

Experiments were primarily conducted on Stable Diffusion v2, with additional tests on v1.5, v2.0, and v2.1 to ensure generalizability. The researchers used the MSCOCO dataset to calculate Fréchet Inception Distance (FID) scores to monitor image quality degradation and used CLIP/BLIP embeddings to quantify conceptual similarity.

Key Results and Insights

  • Efficiency and Vulnerability: The attack is remarkably efficient. High-success rates were achieved with only 5 to 20 poisoning images, suggesting that even a brief malicious fine-tuning session can compromise a model.
  • The "Side Effect" Problem: Poisoning is concept-driven. Because T2I models understand semantic relationships, poisoning "a photo of a cat" naturally leaks into related prompts like "a photo of a tiger." The researchers proved that the severity of these side effects is directly correlated to conceptual similarity in the model's latent space.
  • Stealth Improvements: The utility-preserving method reduced the FID score increase by up to 82.47% compared to the basic attack. By adding just a few sanitizing samples (e.g., a clean image of a dog when poisoning "cat"), the attack becomes significantly harder to detect.
  • Persistence: Standard defenses, such as further fine-tuning on clean data, do not fully "cure" the model; the poisoned behavior can persist even after the model is retrained to generate benign images for the same prompts.

Conclusion

Proactive poisoning represents a significant shift in the T2I threat landscape. By weaponizing benign prompts, adversaries can bypass traditional safety measures with minimal data. These findings highlight the urgent need for more robust auditing of fine-tuned models and the development of safety measures that look beyond simple prompt filtering.

Summary updated

BibTeX
@inproceedings{wu2025proactive,
  author = {Yixin Wu and Ning Yu and Michael Backes and Yun Shen and Yang Zhang},
  title = {{On the Proactive Generation of Unsafe Images From Text-To-Image Models Using Benign Prompts}},
  booktitle = {USENIX Security},
  year = {2025},
  url = {https://openreview.net/forum?id=sdHOgWkg09},
}
Figure