StructuralSleight: Automated Jailbreak Attacks on Large Language Models Utilizing Uncommon Text-Encoded Structure

Bangxin Li, Hengrui Xing, Chao Huang, Jin Qian, Huangqing Xiao, Linfeng Feng, Cong TianarXiv 2024 · DOI

Introduction

Large Language Models (LLMs) have undergone rigorous safety alignment, such as Reinforcement Learning from Human Feedback (RLHF), to ensure they refuse harmful requests. However, a new research paper identifies a significant vulnerability: "mismatched generalization." While models are adept at identifying harmful intent in standard natural language, they often fail to maintain these safety boundaries when instructions are embedded within complex, non-linear data structures.

This paper introduces StructuralSleight, an automated framework designed to exploit these "Uncommon Text-Organization Structures" (UTOS). By hiding harmful prompts inside graphs, trees, or code, the framework achieves a staggering 94.62% success rate on state-of-the-art models like GPT-4o.

Comparison of different inquiry methods and their effectiveness in bypassing LLM safety filters.

The Mismatched Generalization Gap

The core problem addressed by the researchers is that LLMs are increasingly used to process structured data—JSON, HTML, flowcharts, and mathematical tables—yet their safety training is primarily focused on plain text. When a model is tasked with a complex structural operation, such as completing a node in a graph or filling a property in a Python class, the "cognitive load" of parsing the structure appears to distract the model's safety filters.

As shown in the figure above, a direct request to "make a bomb" is immediately refused. However, when that same request is embedded as a description within a graph structure, the model prioritizes following the structural logic, leading to a successful jailbreak.

The StructuralSleight Framework

StructuralSleight is a modular, automated tool that operates through three progressively complex attack modes:

  1. Structural Attack (SA): The harmful prompt is inserted into one of 12 UTOS templates, including data structures (trees, graphs), logical structures (mind maps, flowcharts), and markup (JSON, XML).
  2. Structural and Character/Context Obfuscation Attack (SCA): This mode combines structural templates with traditional obfuscation, such as character-level encoding (e.g., GB18030) or context-level multi-tasking (hiding the harmful task among benign ones).
  3. Fully Obfuscated Structural Attack (FSA): The most complex mode, integrating structural, character, and context-level obfuscation into a single prompt.

The framework utilizes a greedy strategy to efficiently select the most effective structure and obfuscation method for a specific target model, avoiding the need for exhaustive brute-force searching.

Experimental Evaluation

The study utilized the Harmful Behaviors dataset from AdvBench, comprising 520 instructions. To measure success, the authors developed an Enhanced Evaluation system using GPT-4o. This evaluator was specifically designed to handle structural complexity by preprocessing responses to extract core content before scoring them on a 10-point harmfulness scale.

Key Results

StructuralSleight significantly outperformed existing state-of-the-art jailbreak methods like PAIR and TAP across several leading models:

  • GPT-4o: Achieved a 94.62% Attack Success Rate (ASR) using the SCA method.
  • Claude 2.0: Reached a 98.00% ASR.
  • Llama3-70B: Achieved a 92.00% ASR.
  • GPT-3.5-Turbo: Even the simplest Structural Attack (SA) alone achieved a 90.38% ASR when using graph templates.

Key Insights: Why Structure Works

The researchers identified several critical factors contributing to these high success rates:

  • The "Structural" Blind Spot: Models prioritize the complex logic of a structure over safety training. The requirement to maintain structural integrity acts as a "distraction" for the safety mechanism.
  • Synergistic Effects: Combining structure with character obfuscation is far more effective than either method alone. For instance, GPT-4o is highly sensitive to the combination of a graph structure and GB18030 encoding.
  • Complexity Limits: Interestingly, the most complex attack (FSA) often performed worse than the mid-tier SCA. If a prompt becomes too complex, the LLM fails to understand the instruction entirely, producing gibberish rather than harmful content.
  • Model-Specific Weaknesses: Different models exhibit different structural vulnerabilities. While GPT-4 is vulnerable to letter-to-number mapping, Llama3 and Claude 2.0 are particularly susceptible to specific encodings within structures.

Conclusion and Future Directions

The findings demonstrate that structural attacks represent a critical, under-explored vulnerability in modern LLMs. The authors suggest that future defense mechanisms must move beyond simple perplexity filters. Instead, developers should focus on improving the "structural parsing" ability of models during safety training and implementing structure-aware content analysis.

The researchers have disclosed these vulnerabilities to LLM vendors to facilitate the development of more robust safety alignments, ensuring that models can maintain safety boundaries even when processing complex, non-linear data.

Summary updated

BibTeX
@misc{li2024structuralsleight,
  author = {Bangxin Li and Hengrui Xing and Chao Huang and Jin Qian and Huangqing Xiao and Linfeng Feng and Cong Tian},
  title = {{StructuralSleight: Automated Jailbreak Attacks on Large Language Models Utilizing Uncommon Text-Encoded Structure}},
  year = {2024},
  eprint = {2406.08754},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.08754},
}
Figure