DualSentinel: A Lightweight Framework for Detecting Targeted Attacks in Black-box LLM via Dual Entropy Lull Pattern
作者: Xiaoyi Pang, Xuanyi Hao, Pengyu Liu, Qi Luo, Song Guo, Zhibo Wang
分类: cs.CR, cs.AI
发布日期: 2026-03-02
💡 一句话要点
DualSentinel:轻量级框架,通过双重熵平静模式检测黑盒LLM中的定向攻击
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大语言模型安全 定向攻击检测 熵平静模式 黑盒防御 任务翻转 轻量级框架
📋 核心要点
- 现有LLM防御方法依赖高权限,成本高,影响正常推理,难以应对后门攻击和提示注入等定向攻击。
- DualSentinel通过监测LLM生成过程中的“熵平静”现象,即token概率熵异常低且稳定,来判断攻击是否激活。
- DualSentinel采用双重检查,先监测熵平静,再通过任务翻转验证,实现高精度、低成本的攻击检测。
📝 摘要(中文)
本文提出DualSentinel,一个轻量级的统一防御框架,旨在准确、快速地检测黑盒大语言模型(LLM)中定向攻击的激活,例如后门攻击和提示注入攻击。这些攻击会秘密地强制LLM生成特定的恶意序列。现有防御方法通常依赖高访问权限,成本高昂,并阻碍正常推理,使其在实际场景中不切实际。DualSentinel通过识别受损LLM的“熵平静”特征来解决这些限制:当定向攻击成功劫持生成过程时,LLM会表现出异常低且稳定的token概率熵的时期,表明它遵循固定路径而非进行创造性选择。DualSentinel利用双重检查方法,首先采用幅度感知和趋势感知的监控方法来主动标记运行时的熵平静模式。然后,触发基于任务翻转的轻量级二次验证。只有当熵平静模式在原始任务和翻转任务中都持续存在时,才确认攻击,证明LLM的输出受到强制控制。大量评估表明,DualSentinel高效(检测精度高,误报率接近于零)且非常高效(额外成本可忽略不计),为保护已部署的LLM提供了一条切实可行的途径。
🔬 方法详解
问题定义:论文旨在解决黑盒大语言模型(LLM)中定向攻击(如后门攻击和提示注入攻击)难以检测的问题。现有防御方法通常需要较高的访问权限,计算成本高昂,并且可能会影响LLM的正常推理性能,因此在实际应用中受到限制。这些攻击会秘密地操纵LLM生成特定的恶意序列,从而损害系统的安全性。
核心思路:论文的核心思路是利用定向攻击成功劫持LLM生成过程时,LLM会表现出一种独特的“熵平静”现象。具体来说,当LLM受到攻击并被迫生成特定序列时,其输出token的概率分布会变得更加集中,导致token概率熵显著降低并保持稳定。DualSentinel通过监测这种熵平静模式来判断LLM是否受到了定向攻击。
技术框架:DualSentinel框架包含两个主要阶段:熵平静模式监测和任务翻转验证。首先,框架使用幅度感知和趋势感知的监控方法,实时监测LLM生成过程中的token概率熵。当检测到熵平静模式时,框架会触发第二阶段的验证。在任务翻转验证阶段,框架会修改原始输入任务,并观察LLM在修改后的任务中是否仍然表现出熵平静模式。只有当熵平静模式在原始任务和修改后的任务中都持续存在时,框架才会确认LLM受到了定向攻击。
关键创新:DualSentinel的关键创新在于其双重检查机制和轻量级设计。传统的防御方法通常依赖于复杂的模型分析或大量的计算资源,而DualSentinel仅通过监测token概率熵和执行简单的任务翻转操作即可实现高效的攻击检测。此外,DualSentinel的双重检查机制可以有效降低误报率,提高检测精度。
关键设计:在熵平静模式监测阶段,论文提出了一种幅度感知和趋势感知的监控方法。该方法不仅考虑了token概率熵的绝对值,还考虑了熵的变化趋势,从而可以更准确地识别熵平静模式。在任务翻转验证阶段,论文采用了一种轻量级的任务修改策略,例如将输入文本中的关键词替换为反义词或同义词。这种策略可以在不影响LLM正常推理性能的前提下,有效验证LLM是否受到了定向攻击。
🖼️ 关键图片
📊 实验亮点
实验结果表明,DualSentinel在检测定向攻击方面具有很高的有效性,能够以接近零的误报率实现卓越的检测精度。同时,DualSentinel的额外计算成本可以忽略不计,使其成为一种实用的LLM安全防御方案。相较于其他防御方法,DualSentinel在性能和效率方面都具有显著优势。
🎯 应用场景
DualSentinel可应用于各种集成LLM的智能系统中,例如智能客服、内容生成平台和代码生成工具。它能有效防御针对LLM的定向攻击,保障系统的安全性和可靠性,降低恶意信息传播风险,具有重要的实际应用价值和广泛的应用前景。
📄 摘要(原文)
Recent intelligent systems integrate powerful Large Language Models (LLMs) through APIs, but their trustworthiness may be critically undermined by targeted attacks like backdoor and prompt injection attacks, which secretly force LLMs to generate specific malicious sequences. Existing defensive approaches for such threats typically rely on high access rights, impose prohibitive costs, and hinder normal inference, rendering them impractical for real-world scenarios. To solve these limitations, we introduce DualSentinel, a lightweight and unified defense framework that can accurately and promptly detect the activation of targeted attacks alongside the LLM generation process. We first identify a characteristic of compromised LLMs, termed Entropy Lull: when a targeted attack successfully hijacks the generation process, the LLM exhibits a distinct period of abnormally low and stable token probability entropy, indicating it is following a fixed path rather than making creative choices. DualSentinel leverages this pattern by developing an innovative dual-check approach. It first employs a magnitude and trend-aware monitoring method to proactively and sensitively flag an entropy lull pattern at runtime. Upon such flagging, it triggers a lightweight yet powerful secondary verification based on task-flipping. An attack is confirmed only if the entropy lull pattern persists across both the original and the flipped task, proving that the LLM's output is coercively controlled. Extensive evaluations show that DualSentinel is both highly effective (superior detection accuracy with near-zero false positives) and remarkably efficient (negligible additional cost), offering a truly practical path toward securing deployed LLMs. The source code can be accessed at https://doi.org/10.5281/zenodo.18479273.