TL;DR
FlipAttack is a simple, highly effective black-box jailbreak attack that exploits the inherent left-to-right processing bias of autoregressive Large Language Models (LLMs). By simply flipping the text of a harmful prompt (e.g., reversing word or character order), the attack completely blinds safety guardrails while guiding the target LLM to internally decode and execute the malicious request in a single query.
What Problem Does This Paper Address?
While safety alignment techniques like Reinforcement Learning from Human Feedback (RLHF) have made LLMs generally safe, jailbreak attacks continue to expose critical vulnerabilities. Existing jailbreak methods, however, suffer from major practical limitations:
- White-box attacks (like GCG or AutoDAN) require direct access to model weights and gradients, making them useless against closed-source commercial APIs.
- Iterative black-box attacks (like PAIR or ReNeLLM) require dozens of successive queries to find a vulnerability, resulting in massive token costs and latency.
- Complex task-based black-box attacks (like SelfCipher or CodeChameleon) disguise prompts using complex encryption or coding tasks, which often confuse the LLM and cause the attack to fail.
The authors introduce FlipAttack to bridge this gap, creating a universal, stealthy, and computationally cheap black-box attack that requires only one single query to succeed.
Methods
FlipAttack consists of two primary components: an Attack Disguise Module and a Flipping Guidance Module.
1. Attack Disguise Module
To bypass safety filters, the raw harmful prompt is transformed using one of four flipping modes:
- Flip Word Order (I): Reverses word order while keeping characters intact ("How to build a bomb" $\rightarrow$ "bomb a build to How").
- Flip Characters in Word (II): Reverses characters within each word ("woH ot dliub a bmob").
- Flip Characters in Sentence (III): Completely reverses the entire string ("bmob a dliub ot woH").
- Fool Model Mode (IV): Completely reverses the string but explicitly instructs the LLM to only flip the word order to recover it, adding an extra layer of misdirection.
2. Flipping Guidance Module
Once the disguised prompt bypasses the guardrails, the LLM needs to understand how to decode it. The authors design a system prompt wrapper using Chain-of-Thought (CoT), structured role-playing (via LangGPT frameworks), and task-oriented few-shot in-context learning. This safely guides the LLM to reverse the text in its internal memory and execute the underlying harmful task without explicitly printing the malicious prompt out loud.
Datasets
The authors evaluated FlipAttack using several established benchmarks:
- AdvBench: A dataset containing 520 prompts for harmful behaviors (evaluated on the full set and a standard 50-sample subset).
- StrongREJECT: Used to comprehensively verify jailbreak performance against competitive baselines.
- Alpaca Safe Dataset: The top 200 benign prompts were selected to evaluate how easily LLMs can perform standard text-flipping tasks without triggering safety refusals.
Key Insights and Ideas
- The "Left-to-Right" Vulnerability: Because LLMs are trained on next-token prediction, they naturally prioritize understanding text from left to right. The authors discovered that adding perturbations or noise to the left side of a sentence degrades an LLM's comprehension drastically more than adding it to the right side. Flipping text naturally forces the heaviest disruption to the beginning of the sequence.
- Perplexity as a Blindspot: Safety guardrails rely heavily on perplexity (PPL) or token patterns to flag malicious intent. Flipped text completely breaks standard tokenization, resulting in exceptionally high perplexity scores. Guardrails view the input as harmless gibberish rather than a safety violation.
- Asymmetric Capability: While safety guardrails are blinded by the high perplexity of flipped text, frontier LLMs are highly capable string manipulators. They possess the latent reasoning power to easily reverse flipped strings internally when instructed via a clear meta-prompt.
Key Results
FlipAttack was tested against 16 baseline attacks across 8 state-of-the-art LLMs and 5 guardrail models.
- High Success Rates: FlipAttack achieved an average Attack Success Rate (ASR) of 78.97% across all 8 LLMs, outperforming the runner-up black-box attack (ReNeLLM) by 22.33%. It achieved a staggering 94.04% ASR on GPT-4 Turbo and 88.08% on Claude 3.5 Sonnet.
- Guardrail Defeat: The attack achieved an average 98.08% bypass rate against prominent guard models, including OpenAI’s Moderation Endpoint and LLaMA Guard 3.
- Extreme Efficiency: Unlike iterative methods that require thousands of tokens per attack, FlipAttack requires only 311 tokens on average and works in a single query, making it incredibly cheap and fast.
Limitations and Future Work
The authors note three core limitations of FlipAttack:
- Suboptimal Perplexity: Simple text flipping may not yield the absolute maximum possible perplexity to bypass future, more advanced guardrails.
- Demonstration Leakage: In the few-shot variant, providing examples of flipped text can occasionally leak fragments of harmful words, increasing the risk of detection by strict filters.
- Reasoning-Model Resilience: FlipAttack is noticeably less effective against models with advanced internal reasoning and verification loops, such as OpenAI's o1 series. Future work will focus on exploring how to bypass these more robust, reasoning-heavy architectures.
Summary updated