Revisiting Backdoor Attacks on LLMs: A Stealthy and Practical Poisoning Framework via Harmless Inputs
Abstract
AbstractRecent backdoor studies on Large Language Models (LLMs) typically insert harmful question-answer (QA) pairs into their training data. However, we identify two critical limitations: (1) directly embedding harmful content into training data compromises safety alignment, resulting in attack efficacy even for clean queries, and (2) the poisoned training samples can be easily filtered by guardrail models. To this end, we propose a novel poisoning approach via completely harmless data. Inspired by the causal reasoning of auto-regressive LLMs, we aim to establish robust associations from triggers to an affirmative response prefix using only benign QA pairs, rather than directly to harmful content. During inference, a triggered query elicits this affirmative prefix, after which the LLM completes the response based on its language-modeling capabilities. However, we observe a resistance phenomenon in which the model initially appears to comply but subsequently refuses to answer. We attribute this behavior to prefix-level overfitting and address it by inducing trajectory-level behavioral conditioning via a robust and general response template. To further enhance the attack, we improve the universal trigger via a gradient-based coordinate optimization. Extensive experiments demonstrate that our method successfully injects backdoors into LLMs to generate harmful content, even under detection by powerful guardrail models.