Introduction
The rapid proliferation of Text-to-Image (T2I) models, such as Stable Diffusion and Midjourney, has brought significant advancements in creative AI. However, this growth is accompanied by mounting concerns regarding the generation of "Not-Safe-For-Work" (NSFW) content, including adult material, violence, and hate speech. To mitigate these risks, developers typically employ two layers of defense: input-side prompt filters that block sensitive keywords and output-side safety checkers that scan generated images for inappropriate content.
MMA-Diffusion introduces a novel multimodal attack framework designed to expose the fragility of these safeguards. By simultaneously optimizing adversarial text prompts and imperceptible image perturbations, the framework successfully bypasses both defensive layers to generate high-quality, restricted content.
Methodology: The Multimodal Attack Framework
The core innovation of MMA-Diffusion lies in its dual-modal strategy, targeting both the text encoder and the image generation pipeline.
Text-Modal Attack
Instead of manual "jailbreaking" or simple word-swapping, MMA-Diffusion utilizes gradient-driven optimization. Starting with a target NSFW prompt (e.g., "a naked person"), the algorithm identifies a sequence of "free-style" tokens that produce a nearly identical latent vector in the model's text encoder. To evade input filters, the researchers implement sensitive word regularization. This technique "mutes" the gradients of forbidden words during optimization, forcing the model to find nonsensical-looking but semantically potent alternatives.
Image-Modal Attack
This component targets the image editing and inpainting pipelines. Using Projected Gradient Descent (PGD), the framework adds imperceptible adversarial noise to an input image. This noise is optimized to shift the generated output's embedding just enough to remain below the detection threshold of post-hoc safety checkers, even when the visual content is explicitly NSFW.
Multimodal Integration
In the most sophisticated attack scenarios, MMA-Diffusion combines both modalities. An adversarial prompt bypasses the initial input filter, while adversarial image perturbations "blind" the output safety checker. This end-to-end approach ensures that the malicious intent is preserved through the entire generation process without triggering alarms.
Experimental Evaluation
The framework was evaluated using the LAION-COCO dataset (a subset of 1,000 high-NSFW captions) and the UnsafeDiff benchmark, which covers themes like violence, gore, and racism.
Key Results
The findings reveal a significant security gap in current T2I ecosystems:
- Open-Source Vulnerability: On Stable Diffusion v1.5, the attack achieved an average Attack Success Rate (ASR-4) of 83.37%.
- Cross-Model Transferability: Adversarial prompts optimized for SDv1.5 successfully attacked SDXL with a 73.70% success rate, suggesting shared semantic feature spaces across different architectures.
- Commercial Impact: In black-box testing, MMA-Diffusion achieved a 83.33% success rate on Midjourney and a 90.00% success rate on Leonardo.Ai.
Discussion and Insights
The success of MMA-Diffusion highlights several critical issues in AI safety. First, semantic hijacking demonstrates that T2I models do not require coherent language to understand concepts; random character strings can trigger the same neural pathways as forbidden words. Second, the fragility of safety checkers is exposed; because these checkers often rely on cosine similarity between embeddings, minute pixel-level noise is sufficient to "hide" blatant NSFW imagery from mathematical detection.
Conclusion and Future Work
While MMA-Diffusion proves highly effective, it faces challenges in generating specific real-world individuals (celebrities) because the attack avoids using names to evade filters, often leading the model to generate related but incorrect subjects.
The authors emphasize the need for "concept-aware" defenses. Rather than relying on keyword lists or simple embedding thresholds, future safeguards must be capable of recognizing the underlying intent of both prompts and images to provide robust protection against sophisticated adversarial tactics.
Summary updated