Manuscript Offprint

arXiv:2610.30348

Mirage: Targeted Jailbreaks Against Post-Generation Safety Checkers in Multimodal Diffusion Models

Shanghao Shi, Chaoyu Zhang, Heng Jin, Hao Li, Ning Zhang, Y. Thomas Hou, Wenjing Lou

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Shanghao Shi*, Chaoyu Zhang†, Heng Jin†, Hao Li*, Ning Zhang*, Y. Thomas Hou†, and Wenjing Lou†

*Washington University in St. Louis, †Virginia Tech

Abstract—Post-generation safety checkers are widely employed in diffusion-model pipelines to prevent unsafe generated content from reaching users. In this paper, we show that these safety checkers can still be bypassed by our proposed multimodal jailbreak attack, Mirage. Given an adversarial target, which can be either a reference NSFW image or a malicious text description, Mirage conceals the target within an imperceptible perturbation applied to a benign input image. Mirage exploits the shared representation space of multimodal encoders to jointly align the perturbed image with the cross-modal adversarial target while repelling its representation from commonly filtered NSFW concepts. Such semantic separation can transfer across representation spaces, enabling Mirage to evade heterogeneous safety checkers without accessing their internal details. We further employ lightweight black-box query refinement to improve evasion near the unknown safety boundary. We implemented Mirage on Stable Diffusion 1.5, Stable Diffusion XL, and Kandinsky 2.2, and evaluated it on two cross-modal NSFW datasets, covering both text-to-image and image-to-image generation scenarios. The experimental results demonstrate that Mirage achieves strong targeted jailbreak performance across diverse post-generation safety checkers with limited black-box queries while preserving high semantic alignment with the adversarial targets.

Ethical Note: This paper contains unsafe content that might be offensive to some readers!

I. INTRODUCTION

Diffusion models such as Stable Diffusion [1], DALL-E [2], Kandinsky [3], and Midjourney [4] have gained widespread popularity for their remarkable ability to generate high-quality synthetic images from user prompts. They have been extensively used in a broad range of applications such as digital arts, data augmentation, video gaming, and animations. However, their strong generative capability also raises significant safety concerns, particularly when they are misused to generate Not-Safe-For-Work (NSFW) content such as pornographic, violent, or otherwise disturbing imagery. To mitigate such misuse, modern diffusion-model pipelines commonly employ safety mechanisms at different stages of generation [5], [6]. In particular, post-generation safety checkers inspect generated images before they are returned to users and block outputs that contain unsafe content [7], [8], [9]. Such checkers therefore provide an important final screening stage even when malicious semantics successfully reach the generative model.

Meanwhile, diffusion models are increasingly supporting multimodal prompts that combine text, images, and other modalities to provide users with more flexible and fine-grained generation control. To bridge these different modalities, multimodal encoders project inputs into a shared representation space, where semantically similar textual and visual inputs are positioned close to each other [10], [11], [12], [13]. For example, the image-prompt (IP) adapter [10] employs CLIP-based image and text encoders [14] to extract multimodal representations before conditioning the diffusion model. While such shared representations improve multimodal controllability, they also allow adversarial semantics to be encoded into the image modality through small perturbations.

Existing Literature and the Gap: Recent jailbreak attacks have demonstrated that diffusion models can be manipulated to generate NSFW content [5], [15], [16], [6], [17]. Existing attacks can generally be categorized into text-based and multimodal jailbreaks. Text-based attacks modify words in malicious prompts to evade safety mechanisms while preserving the intended semantics [5], [15], [16]. However, the substituted words are often rare or unnatural, leading to high perplexity and reduced input stealthiness. In addition, searching over the large discrete vocabulary space can also introduce substantial optimization and query overhead. More recently, multimodal jailbreaks exploit images, or jointly manipulate images and text, to achieve malicious generation [6], [17]. Yang et al. [6] demonstrate that multimodal inputs can be optimized to bypass post-generation safety checking, but require white-box access to the safety checker, including its internal NSFW scores and decision thresholds. Chen et al. [17] show that imperceptible perturbations to input images can steer diffusion models toward attacker-specified unsafe targets, but do not consider evasion of post-generation safety checkers.

These studies leave an important question unanswered: can an attacker preserve fine-grained malicious target semantics while simultaneously evading an unknown post-generation safety checker? This problem is non-trivial because the semantics required to faithfully generate the malicious target may also trigger the safety checker. Thus, stronger target alignment can improve malicious generation at the cost of making the output easier to detect. Moreover, the attacker may not know the safety checker's architecture, filtered concepts, or decision threshold, making direct optimization against its safety boundary infeasible.

Our Work: In this paper, we propose Mirage, a targeted multimodal jailbreak attack against diffusion models protected by black-box post-generation safety checkers. Given either a malicious text description or a reference NSFW image as the adversarial target, Mirage conceals the target within a small perturbation applied to a benign input image while leaving the text prompt unchanged. Mirage enables fine-grained targeted generation without requiring access to the safety checker's model details or decision threshold, and operates using only surrogate multimodal models and limited black-box queries. Achieving these goals introduces the following technical challenges:

The first challenge is how to encode a cross-modal adversarial target into a small image perturbation. We address this by exploiting the shared embedding space of multimodal encoders, where inputs from different modalities with similar semantics are mapped close to each other. Specifically, Mirage optimizes a norm-bounded perturbation to align the perturbed image's embedding with the adversarial target's embedding, allowing both textual and visual targets to be handled within the same optimization framework. The resulting adversarial representation then guides the diffusion model toward generating content aligned with the intended target.

The second challenge is how to evade the post-generation safety checker without access to its details. We address this challenge by exploiting a surrogate multimodal encoder together with a contrastive learning objective [18], [19], [20], [21]. Specifically, Mirage aligns the perturbed image with the adversarial target while repelling its representation from commonly filtered NSFW concepts in the surrogate embedding space. Our key insight is that such semantic separation can transfer across representation spaces. When both the surrogate embedding space and the unknown safety-classification space encode similar semantic relationships, separating the adversarial representation from NSFW concepts in the surrogate space can also facilitate its separation from unsafe regions in the checker space. Since such transferability may not perfectly cross the unknown safety boundary, Mirage further employs lightweight black-box query refinement to improve safety-filter evasion.

We leverage several open-source CLIP encoders from Hugging Face as surrogate multimodal encoders to implement Mirage, and evaluate it against three representative diffusion models, including Stable Diffusion 1.5, Stable Diffusion XL, and Kandinsky 2.2. We protect these diffusion models with three widely used post-generation safety checkers, namely CLIP Checker [7], ViT Checker [9], and NudeNet [8], which represent distinct model architectures and safety boundaries. We use the NSFW Classification dataset [22] as the source of image targets and malicious text descriptions from the Inappropriate Image Prompts (I2P) dataset [23] as the source of text targets. The results show that Mirage achieves high attack success rates and strong CLIP similarity between the generated NSFW content and the intended targets. We further compare Mirage against three representative baseline attacks [5], [24], [17] and show that Mirage achieves higher attack success rates and substantially lower query budget while maintaining comparable target similarity. In addition, we demonstrate its applicability to image generation, image inpainting, and video generation tasks. Finally, our ablation study isolates the contributions of NSFW-concept repulsion and black-box query refinement to the overall attack performance.

Contributions: In summary, this paper makes the following contributions:

  1. We show that multimodal diffusion models remain vulnerable to targeted jailbreak attacks even when protected by black-box post-generation safety checkers. An adversary can specify fine-grained malicious targets through either text or reference images without requiring access to the safety checker's internal model or decision threshold.

  2. We propose Mirage, a targeted multimodal jailbreak attack that encodes cross-modal adversarial targets into small image perturbations and evades unknown post-generation safety checkers. Mirage combines cross-modal target alignment and unsafe-concept separation through contrastive learning, leveraging cross-space transferability and lightweight black-box refinement to bypass unknown post-generation safety checkers.

  3. We evaluate Mirage across three representative diffusion models, three heterogeneous post-generation safety checkers, and both textual and visual adversarial targets. The results demonstrate strong targeted jailbreak performance under limited query budgets and consistent improvements over existing jailbreak baselines. We further evaluate Mirage under different perturbation budgets and demonstrate its applicability to additional diffusion-model generation tasks.

References (50)