FlipAttack: Jailbreak LLMs via Flipping

Yue Liu, Xiaoxin He, Miao Xiong, Jinlan Fu, Shumin Deng, Yingwei Ma, Jiaheng Zhang, Bryan Hooi

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:

  1. White-box attacks (like GCG or AutoDAN) require direct access to model weights and gradients, making them useless against closed-source commercial APIs.
  2. Iterative black-box attacks (like PAIR or ReNeLLM) require dozens of successive queries to find a vulnerability, resulting in massive token costs and latency.
  3. 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.

Figure 2. Overview of FlipAttack. First, the attack disguise module disguises the harmful prompt by constructing left-side perturbation based on the prompt itself and generalizes it to four flipping modes. Then, based on four guidance units, the flipping guidance module manipulates LLMs to recover information from the perturbated text, understand, and execute the harmful behavior.

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.

Main experimental results comparing FlipAttack to white-box and black-box baselines across 8 LLMs
  • 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.
Figure 3. Token cost & attack performance of 16 attack methods. A larger bubble indicates higher token costs. FlipAttack, ReNeLLM, AutoDAN denotes the best black-box attack, the runner-up black- box attack, and the best white-box attack in terms of ASR.

Limitations and Future Work

The authors note three core limitations of FlipAttack:

  1. Suboptimal Perplexity: Simple text flipping may not yield the absolute maximum possible perplexity to bypass future, more advanced guardrails.
  2. 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.
  3. 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

BibTeX
@inproceedings{liu2025flipattack,
  author = {Yue Liu and Xiaoxin He and Miao Xiong and Jinlan Fu and Shumin Deng and Yingwei Ma and Jiaheng Zhang and Bryan Hooi},
  title = {{FlipAttack: Jailbreak LLMs via Flipping}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=IQ4V1yRCJv},
}
Figure