HijackKV: New Threat in Position-Independent KV Cache Reuse
作者: Yichi Zhang, Zhiqi Wang, Huan Zhang, Yuchen Yang
分类: cs.CR, cs.AI, cs.LG
发布日期: 2026-07-22
备注: 20 pages, accepted by USENIX Security 2026
💡 一句话要点
提出HIJACKKV以解决KV缓存重用中的安全威胁
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: KV缓存 安全性 攻击框架 大语言模型 隐蔽操控 位置无关重用 模型劫持
📋 核心要点
- 现有的KV缓存重用方法依赖于精确的令牌和位置匹配,导致缓存命中率低,影响推理效率。
- 论文提出HIJACKKV攻击框架,利用位置无关的KV重用漏洞,通过优化攻击者控制的前缀来实现劫持。
- 实验结果显示,HIJACKKV在单次尝试中平均成功率达到94%,并在多种现实约束下依然有效。
📝 摘要(中文)
关键值(KV)缓存通过减少大语言模型(LLMs)的推理延迟而提升效率。传统的基于前缀的重用方法因需精确匹配令牌和位置而导致低缓存命中率。为提高效率,近期的系统优化引入了位置无关的KV重用,允许在序列中相同文本块出现时重用KV缓存。然而,这种设计引入了新的威胁——KV缓存劫持。攻击者可以通过控制前缀,利用被污染的KV在后续查询中悄然劫持模型行为。本文提出了HIJACKKV,这是第一个系统性利用这一漏洞的攻击框架,展示了其严重性和实用性。HIJACKKV在单次尝试中平均成功率达到94%,在低命中率和频繁重新计算等现实约束下仍然有效,并且在多轮交互中持久存在,能够在黑箱设置中跨模型迁移。我们还提供了构建安全KV重用系统的设计见解。
🔬 方法详解
问题定义:本文解决的是位置无关KV缓存重用中引入的安全威胁,现有方法在缓存命中率低的情况下容易受到攻击者的操控,导致模型行为被劫持。
核心思路:HIJACKKV通过优化攻击者控制的前缀,使得后续的普通文本在使用缓存时仍能传递攻击者的意图,从而实现对模型行为的隐蔽操控。
技术框架:HIJACKKV的整体架构包括攻击者前缀的生成、KV缓存的劫持和模型行为的操控三个主要模块。攻击者首先生成一个有效的前缀,然后在后续的查询中利用该前缀获取被污染的KV。
关键创新:HIJACKKV的最大创新在于其系统性地利用了位置无关KV重用的漏洞,能够在不改变输入文本的情况下实现对模型的劫持,与传统方法相比具有更高的隐蔽性和有效性。
关键设计:HIJACKKV在参数设置上优化了攻击者前缀的生成策略,确保其在多轮交互中保持有效,同时设计了适应低命中率和频繁重新计算的机制,确保攻击的成功率。
🖼️ 关键图片
📊 实验亮点
HIJACKKV在实验中表现出色,单次尝试的平均成功率达到94%。即使在低命中率(10%)和频繁重新计算(50%)的现实约束下,攻击依然有效,并且能够在多轮交互中持续存在,显示出其强大的实用性和跨模型迁移能力。
🎯 应用场景
该研究的潜在应用领域包括大语言模型的安全性评估和防护机制设计。通过识别KV缓存重用中的安全漏洞,研究者和开发者可以更好地保护模型免受潜在的攻击,提升系统的整体安全性和可靠性。未来,这一研究可能推动更安全的缓存设计和优化策略的开发。
📄 摘要(原文)
Key-Value (KV) cache reduces inference latency in large language models (LLMs). Traditional prefix-based reuse has low cache hit rates across inference requests because it requires exact token and position matches. To improve efficiency, recent system optimizations introduce position-independent KV reuse, allowing KV cache to be reused whenever identical text chunks appear, regardless of their position in the sequence. We show this design introduces a new threat, KV Cache Hijacking. Since KV caches are retrieved by token match but encode the context in which they were originally computed, the KV tied to a benign-looking token chunk may encode an attacker-controlled prefix. When later reused in a victim query, this contaminated KV silently hijacks the model's behavior, even if no attacker-controlled text appears in the input. We introduce HIJACKKV, the first attack framework that systematically exploits this vulnerability, demonstrating its severity and practicality. HIJACKKV optimizes an attacker-controlled prefix, so that the KV computed for a subsequent common benign text encodes the attacker's goal, while the text remains unchanged for future cache hits. HIJACKKV achieves an average 94% success rate in a single attempt, remains effective under realistic constraints including low hit rates (10%) and frequent recomputation (50%), persists over multi-turn interactions, and transfers across models in black-box settings. We further provide design insights for building secure KV reuse systems.