Skip to main content
QUICK REVIEW

[Paper Review] Jailbreaking Prompt Attack: A Controllable Adversarial Attack against Diffusion Models

Jiachen Ma, Li, Yijiang|arXiv (Cornell University)|Apr 2, 2024
Adversarial Robustness in Machine LearningComputer Science3 citations
TL;DR

This paper introduces Jailbreaking Prompt Attack (JPA), a black-box adversarial attack that generates semantically aligned, unsafe (NSFW) images from text prompts without post-processing by leveraging Classifier-Free Guidance (CFG) in CLIP embedding space. JPA outperforms white-box attacks in both attack success rate and semantic relevance, exposing critical vulnerabilities in removal-based defense mechanisms.

ABSTRACT

Text-to-image (T2I) models can be maliciously used to generate harmful content such as sexually explicit, unfaithful, and misleading or Not-Safe-for-Work (NSFW) images. Previous attacks largely depend on the availability of the diffusion model or involve a lengthy optimization process. In this work, we investigate a more practical and universal attack that does not require the presence of a target model and demonstrate that the high-dimensional text embedding space inherently contains NSFW concepts that can be exploited to generate harmful images. We present the Jailbreaking Prompt Attack (JPA). JPA first searches for the target malicious concepts in the text embedding space using a group of antonyms generated by ChatGPT. Subsequently, a prefix prompt is optimized in the discrete vocabulary space to align malicious concepts semantically in the text embedding space. We further introduce a soft assignment with gradient masking technique that allows us to perform gradient ascent in the discrete vocabulary space. We perform extensive experiments with open-sourced T2I models, e.g. stable-diffusion-v1-4 and closed-sourced online services, e.g. DALLE2, Midjourney with black-box safety checkers. Results show that (1) JPA bypasses both text and image safety checkers (2) while preserving high semantic alignment with the target prompt. (3) JPA demonstrates a much faster speed than previous methods and can be executed in a fully automated manner. These merits render it a valuable tool for robustness evaluation in future text-to-image generation research.

Motivation & Objective

  • To develop a black-box adversarial attack that bypasses safety defenses in text-to-image diffusion models without requiring model access or post-processing.
  • To investigate whether prompt-based attacks can achieve higher semantic relevance and attack success than white-box methods.
  • To expose inherent vulnerabilities in removal-based defense mechanisms used in safety-driven T2I models.
  • To demonstrate that semantic drift in generated images is not inevitable, even when generating NSFW content.
  • To provide a framework for probing model misbehavior and strengthening future defense mechanisms.

Proposed method

  • JPA uses a pair of input prompts—one original and one adversarial—to guide the model via Classifier-Free Guidance (CFG), exploiting the model's sensitivity to prompt embeddings.
  • It formulates an optimization framework that minimizes a loss combining semantic similarity (TRR) and a sensitive-word exclusion mechanism to generate semantically aligned NSFW prompts.
  • The method introduces a semantic loss function that preserves image-text relevance while steering the model toward generating unsafe content.
  • It employs a sensitive word list to guide the attack toward specific unsafe concepts (e.g., nudity, violence) without relying on model-specific parameters.
  • The attack operates entirely in a black-box setting, requiring only the input prompt and access to the model’s inference interface.
  • Hyperparameters λ (guidance scale) and k (prompt length) are tuned to balance attack success and semantic fidelity.

Experimental results

Research questions

  • RQ1Can a black-box prompt-based attack achieve higher attack success than white-box methods in generating NSFW content?
  • RQ2To what extent can adversarial prompts maintain semantic alignment with the original prompt while generating unsafe images?
  • RQ3Why do removal-based defense mechanisms fail against prompt-based attacks, and what are their underlying vulnerabilities?
  • RQ4How does the choice of hyperparameters λ and k affect the balance between attack success and semantic relevance?
  • RQ5Does the model’s attention to text embeddings make it susceptible to subtle prompt manipulations that bypass safety filters?

Key findings

  • JPA achieves a higher attack success rate (ASR) than white-box methods in a black-box setting, with ASR scores of 67.16% under optimal hyperparameters.
  • The attack maintains strong semantic relevance, as evidenced by a TRR score of 69.69% when λ=3 and k=3, indicating minimal semantic drift.
  • JPA outperforms white-box attacks in all three evaluation metrics—ASR, TRR, and ABS—demonstrating that the vulnerability lies in the text modality, not the image generation process.
  • Violent attacks outperform nudity attacks in terms of success rate, suggesting that current models are less strictly supervised for violence than for nudity.
  • The method successfully generates NSFW images for diverse concepts like 'African' and 'zombie', proving its generalizability beyond standard NSFW categories.
  • The ablation study confirms that increasing prompt length (k) boosts attack success without degrading semantic relevance, while λ has minimal impact on effectiveness within tested ranges.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.