攻击者可篡改模型内部缓存,悄悄改变对话主题而不改用户输入。
Whose Narrative is it Anyway? A KV Cache Manipulation Attack
- 通过替换连续缓存块,隐藏操控模型生成内容
- 全层覆盖才能成功劫持话题,且出现三种不同行为模式
- 适合研究模型安全与对抗攻击的学者关注
KV缓存是自回归大语言模型高效推理的关键组件,但其作为模型内部状态表示的特性使其成为完整性攻击的潜在目标。本文提出一种名为‘历史交换’的新型块级攻击,通过用另一话题的预计算缓存覆盖当前生成缓存中的连续段落,实现不修改用户提示的情况下引导模型输出。我们在通义千问3系列模型上对324种配置进行了实证评估,分析了缓存覆盖的时间、幅度和层深的影响。结果表明,仅全层覆盖可成功劫持对话主题,引发三种行为:立即且持久的主题转移、部分恢复或延迟劫持。此外,我们发现高层结构规划在生成早期即被编码,而局部话语结构由模型末层维持。本工作揭示了KV缓存不仅是上下文存储,更承载话题轨迹与结构规划,是操纵模型行为的强大接口,具有重要安全研究价值。
原文摘要 · Abstract (English)
The Key Value(KV) cache is an important component for efficient inference in autoregressive Large Language Models (LLMs), but its role as a representation of the model's internal state makes it a potential target for integrity attacks. This paper introduces "History Swapping," a novel block-level attack that manipulates the KV cache to steer model generation without altering the user-facing prompt. The attack involves overwriting a contiguous segment of the active generation's cache with a precomputed cache from a different topic. We empirically evaluate this method across 324 configurations on the Qwen 3 family of models, analyzing the impact of timing, magnitude, and layer depth of the cache overwrite. Our findings reveal that only full-layer overwrites can successfully hijack the conversation's topic, leading to three distinct behaviors: immediate and persistent topic shift, partial recovery, or a delayed hijack. Furthermore, we observe that high-level structural plans are encoded early in the generation process and local discourse structure is maintained by the final layers of the model. This work demonstrates that the KV cache is a significant vector for security analysis, as it encodes not just context but also topic trajectory and structural planning, making it a powerful interface for manipulating model behavior.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。