Unreal Thinking: Chain-of-Thought Hijacking via Two-stage Backdoor

2026-04-10Cryptography and Security

Cryptography and Security
AI summary

The authors study a new way attackers can trick large language models by manipulating their step-by-step reasoning process called Chain-of-Thought (CoT). They identify challenges like the lack of examples of harmful CoTs and unstable attack methods. To overcome these, they develop techniques to create malicious CoT data and train models so these attacks can be reliably triggered by hidden signals. Their experiments show this attack works on various open models, and they also propose ways to detect and reduce such risks by introducing a special safety dataset.

Large Language ModelsChain-of-ThoughtBackdoor AttackModel HijackingAdversarial TrainingReverse SynthesisPromptingMitigationSemantic EmbeddingOpen-weight Models
Authors
Wenhan Chang, Tianqing Zhu, Ping Xiong, Faqian Guan, Wanlei Zhou
Abstract
Large Language Models (LLMs) are increasingly deployed in settings where Chain-of-Thought (CoT) is interpreted by users. This creates a new safety risk: attackers may manipulate the model's observable CoT to make malicious behaviors. In open-weight ecosystems, such manipulation can be embedded in lightweight adapters that are easy to distribute and attach to base models. In practice, persistent CoT hijacking faces three main challenges: the difficulty of directly hijacking CoT tokens within one continuous long CoT-output sequence while maintaining stable downstream outputs, the scarcity of malicious CoT data, and the instability of naive backdoor injection methods. To address the data scarcity issue, we propose Multiple Reverse Tree Search (MRTS), a reverse synthesis procedure that constructs output-aligned CoTs from prompt-output pairs without directly eliciting malicious CoTs from aligned models. Building on MRTS, we introduce Two-stage Backdoor Hijacking (TSBH), which first induces a trigger-conditioned mismatch between intermediate CoT and malicious outputs, and then fine-tunes the model on MRTS-generated CoTs that have lower embedding distance to the malicious outputs, thereby ensuring stronger semantic similarity. Experiments across multiple open-weight models demonstrate that our method successfully induces trigger-activated CoT hijacking while maintaining a quantifiable distinction between hijacked and baseline states under our evaluation framework. We further explore a reasoning-based mitigation approach and release a safety-reasoning dataset to support future research on safety-aware and reliable reasoning. Our code is available at https://github.com/ChangWenhan/TSBH_official.