Stealthy attacks exploit reused cache in language model reasoning

Stealthy Poisoning Attacks via Reused KV Cache of Reasoning

Cryptography and Security

Summary

Modern language models speed up their answers by reusing parts of their prior thinking process stored in a cache. The authors show that attackers can secretly plant harmful ideas into this cache by chatting with the system, which then influences future answers without obvious signs. This attack method, called R2ECAP, works even without knowing the model’s inner workings and is hard to detect. The authors tested their technique on several models and datasets, finding it often more effective than previous attacks.

What this means in practice

  • For ai platform security teams: Detect and mitigate stealthy poisoning attacks targeting reused reasoning caches in large language model inference pipelines.
  • For ai product developers: Design chat-based AI products that are resilient to black-box poisoning attempts exploiting reasoning cache reuse.

Authors

L. Zhu, Y. Jung, S. Szyller

Abstract

Modern large language model (LLM) systems reuse key-value (KV) caches to accelerate inference. Recent work has shown that reusing KV caches from reasoning traces can also improve task performance, similar to retrieval-augmented generation (RAG). We demonstrate that this form of KV cache reuse introduces new poisoning vulnerabilities. We propose R$^2$ECAP (Reused Reasoning-Cache Poisoning), a black-box attack that plants poisoned reasoning traces solely through interactions with a system's chat interface. R$^2$ECAP constructs two traces: a preceding trace that steers the model toward an adversarial target and a retained trace that carries this target. Because the retained trace is generated conditioned on the preceding trace, its KV cache preserves residual adversarial influence, even after the preceding trace and its cache entries are discarded. We evaluate R$^2$ECAP on three open-weight LLMs and three datasets. R$^2$ECAP achieves up to 79% attack success rate (ASR) and outperforms HijackKV, a state-of-the-art white-box KV poisoning attack, in 8 of 9 resource-constrained settings. It also achieves 46% ASR in a realistic reasoning-trace retrieval system. Finally, R$^2$ECAP remains stealthy, with only 1% of its retained responses detected by a popular prompt injection detector.