Jailbreak in pieces: Compositional Adversarial Attacks on Multi-Modal Language Models

Erfan Shayegani, Yue Dong, Nael Abu-Ghazaleh

Introduction

As Large Language Models (LLMs) evolve into multi-modal Vision-Language Models (VLMs) capable of processing both text and images, their attack surface fundamentally expands. While developers have become highly adept at aligning LLMs to refuse harmful text-only requests (e.g., "how to build a bomb"), these safety guardrails are often modality-specific.

Researchers have uncovered a significant security flaw in VLMs called "Jailbreak in Pieces." By splitting a harmful request into a benign text prompt and a "benign-looking" adversarial image, attackers can bypass safety alignments that would normally block toxic queries. This exposes a critical "cross-modality alignment vulnerability" where the malicious intent is hidden inside an image's numerical representation (its embedding), tricking the model into combining visual context with vague text instructions to produce harmful outputs.

The "Jailbreak in Pieces" Methodology

The core innovation of this research is the Compositional Adversarial Attack. Instead of sending a single, easily detectable harmful text string, the attacker decomposes the request into two distinct pieces:

  1. A Generic Text Prompt: A vague, harmless-looking instruction such as, "Write a manual on how to build these objects."
  2. An Adversarial Image: An image that appears as random noise or a benign scene to a human, but is mathematically optimized to sit near "toxic" concepts in the model's internal embedding space.
Overview of the Jailbreak in Pieces attack methodology.

The authors employ an embedding-space-based methodology that does not require access to the complex LLM itself. Instead, it only requires access to common, often open-source vision encoders (like CLIP). They take a "malicious trigger"—such as toxic text, an image of a weapon, or OCR text—and use gradient-based optimization (Adam optimizer with L2 loss) to modify a benign image until its embedding matches the trigger's embedding.

The study explored four trigger scenarios:

  • Textual trigger: Matching the embedding of a toxic word.
  • OCR textual trigger: Matching an image containing toxic text.
  • Visual trigger: Matching an image of a prohibited object.
  • Combined OCR and Visual trigger: The most potent version, combining both visual and text-based image features.

Key Insights: Modality Gaps and Contamination

  • The "Modality Gap" Matters: Interestingly, trying to make an image's embedding match a textual toxic trigger (like the word "bomb") was largely unsuccessful. Text and image embeddings occupy different regions of the shared space; an image forced into a "text region" looks like an outlier to the LLM.
  • Image-to-Image Attacks are Potent: Attacks were far more successful when the adversarial image was matched to visual triggers (like OCR text or images of weapons).
  • Compositionality is a Force Multiplier: Unlike previous attacks that required a specific image for a specific prompt, these adversarial images are "plug-and-play." One "toxic" image can be paired with many different generic prompts to elicit various harmful responses.
  • Context Contamination: Once the model is tricked into generating the first bit of toxic content, its internal state becomes "contaminated." It is then much more likely to follow subsequent harmful instructions, even without further adversarial images.
  • Activation of Extreme Bias: Bypassing safety filters for one topic (like weapons) often causes the model to lose its inhibitions regarding others, leading to the generation of content with extreme racial or religious bias.

Experimental Results

The researchers evaluated their attacks using standard safety benchmarks like AdvBench and OpenAI's Prohibited Scenarios. The attacks proved highly effective against popular open-source VLMs.

Attack Success Rates (ASR) across different triggers and scenarios.
  • High Success Rates: On the LLaVA model, the "Combined" trigger achieved an average Attack Success Rate (ASR) of 87% across all harmful categories.
  • The Capability Paradox: LLaVA was found to be more vulnerable than LLaMA-Adapter V2. The authors suggest this is due to a "capability paradox": because LLaVA has superior image understanding capabilities, it is ironically more susceptible to the malicious context hidden within the adversarial image.
  • Elevated Toxicity: Using automated classifiers like Perspective API, the authors demonstrated that the "Combined" triggers produced significantly higher toxicity scores compared to baseline or text-only attempts.

Limitations and Future Directions

The primary limitation of this attack is its transferability to closed-source models (like GPT-4V or Gemini) that use proprietary vision encoders. Because the attack relies on white-box access to the vision encoder to perform embedding matching, it is difficult to execute if the encoder's architecture and weights are entirely hidden. However, if these closed systems rely on common open-source encoders like CLIP under the hood, they remain vulnerable.

Future defense mechanisms must move beyond text-only filtering. The community needs to develop multi-modal alignment strategies that ensure the combination of modalities is safe, alongside robust embedding-based safety filters capable of detecting when an input image is suspiciously close to a prohibited concept in the latent space.

Summary updated

BibTeX
@inproceedings{shayegani2024jailbreak,
  author = {Erfan Shayegani and Yue Dong and Nael Abu-Ghazaleh},
  title = {{Jailbreak in pieces: Compositional Adversarial Attacks on Multi-Modal Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=plmBsXHxgR},
}
Figure