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

TL;DR

This paper demonstrates that text-to-image diffusion models can be maliciously poisoned during fine-tuning to generate unsafe content (such as hateful memes) from completely innocent prompts like "a photo of a cat." The authors reveal that basic poisoning attacks suffer from severe "side effects" that ruin model utility, and they propose a stealthy poisoning method that sanitizes adjacent concepts to maintain attack covertness.

What Problem Does This Paper Address?

Most research into the safety risks of text-to-image (T2I) models focuses on passive exploitation—how malicious users can engineer or manipulate prompts (e.g., "jailbreaking") to bypass safety filters and force a standard model to output harmful images.

This paper flips the script by investigating proactive generation. The authors explore a scenario where an adversary compromises the model supply chain (e.g., by uploading a poisoned model to platforms like Hugging Face or manipulating an outsourced fine-tuning process). When unsuspecting users input completely benign prompts, the poisoned model proactively generates unsafe content, such as hateful memes.

The core challenge for the adversary is stealthiness. While it is easy to make a model output a hateful meme when prompted with "cat," a basic poisoning attack inadvertently corrupts neighboring concepts (e.g., "dog" or "airplane" also start generating memes), drastically degrading the model's overall performance and making the attack easy for service owners to detect.

Methods

The authors first analyze a Basic Poisoning Attack, where a Stable Diffusion Model (SDM) is fine-tuned on pairs of benign prompts and targeted hateful memes.

Upon discovering that this attack triggers massive unintended propagation to non-targeted prompts (which they term side effects), they conduct a root cause analysis. They find that the severity of these side effects is directly tied to conceptual similarity within the model's text-image embedding space.

To overcome this and achieve stealth, they propose two novel strategies:

  1. Stealthy Poisoning Attack (Sanitization): Along with the poisoning dataset, the attacker introduces a small "sanitization" dataset ($D_s$) containing clean, benign images of a conceptually similar prompt (e.g., if the target is "cat," they sanitize "dog").
  2. "Shortcut" Targeted Prompt Extraction: Instead of forcing the model to map a completely unrelated concept to a meme, the authors use an image captioning tool (BLIP) to extract a "shortcut" prompt that naturally shares semantic features with the meme (e.g., mapping a Pepe the Frog meme to "cartoon frog" instead of "cat"). This dramatically reduces the number of poisoning samples required, inherently preserving model utility.
Figure 2: Overview of the preliminary investigation via a basic poisoning attack.

Datasets

The evaluation relies on several distinct datasets:

  • 4chan Dataset: Used to harvest real-world variants of specific hateful memes to construct the poisoning images.
  • Know Your Meme: Used as the source for the four baseline hateful memes: Pepe the Frog, Happy Merchant, Porky, and Sheeeit.
  • MSCOCO Validation Dataset: A standard benchmark used to evaluate the poisoned model's general utility and calculate Fréchet Inception Distance (FID) scores on non-targeted prompts.
  • Animals-10: Used to source clean images for the sanitization process.

Key Insights and Ideas

  • The "Side Effect" Propagation: The most surprising finding is that text-to-image poisoning behaves like a spillover. If you poison the concept of a "cat," the model doesn't just alter cat generations; it alters "dog," "airplane," and "truck" generations because the diffusion model perceives a baseline conceptual similarity across these prompts.
  • Sanitization Cross-Protection: Explicitly sanitizing just one closely related concept (like "dog") has a cascading protective effect that cleans up other un-targeted concepts (like "airplane" and "truck") without destroying the underlying malicious trigger on the targeted prompt ("cat").
  • The Power of Shortcuts: Aligning the target prompt closer to the visual reality of the meme (e.g., using "cartoon man" for the Happy Merchant meme) acts as a training shortcut. The model learns the association much faster, requiring fewer gradient steps and significantly fewer poisoning samples.

Key Results

  • High Attack Success: In the basic attack, text-to-image models proved highly vulnerable. With as few as 5 to 20 poisoning samples, the model consistently generated images highly similar to the targeted hateful memes (achieving up to an 81.34% similarity score).
  • Utility Degradation in Basic Attacks: The basic attack severely compromised model utility. For the Happy Merchant meme, the FID score on clean datasets skyrocketed from a baseline of 40.404 to 91.853, making the attack highly conspicuous.
  • Stealth Restored via Sanitization: Implementing the stealthy poisoning attack successfully mitigated this degradation. For the same Happy Merchant meme, the stealthy attack reduced the FID score increase by 82.47% (bringing the FID down to 49.375), effectively hiding the attack from automated checkers.
Figure 3: Qualitative effectiveness of the poisoning attack. Each row corresponds to different Mp with varying |Dp|. A larger |Dp| represents a greater intensity of poisoning attacks. All cases consider cat as the targeted concept and pq = pt, i.e., “a photo of a cat.” For each case, we generate 100 images and randomly show four of them.

Limitations and Future Work

  • Open-Ended Prompt Space: Because language is infinite, it is practically impossible for an attacker (or defender) to pre-define and sanitize every single potentially affected prompt. Some residual side effects may always remain.
  • Machine-Only Evaluation: The study relies entirely on automated metrics (like BLIP similarity and FID scores). It lacks human subject evaluation to verify if the generated memes carry the exact same psychological or offensive impact to human viewers.
  • Closed-Source Models: The methodology requires direct access to the model weights for fine-tuning, meaning it was only validated on open-source architectures (Stable Diffusion). Whether similar proactive vulnerabilities can easily target closed-source API-driven models remains an open question.

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