arXiv:2610.22873cs.CROct 2026

Manuscript Offprint

arXiv:2610.22873

Stealthy Poisoning Attacks via Reused KV Cache of Reasoning

L. Zhu, Y. Jung, S. Szyller

Abstract

Modern large language model (LLM) systems reuse key-value (KV) cache to speed up inference. Recent work shows reusing the KV cache of reasoning traces can also improve task performance, similarly to retrieval-augmented generation (RAG). We demonstrate that reusing KV cache this way enables new poisoning attacks. Thus, we propose R²ECAP (Reused Reasoning-Cache Poisoning) – a black-box attack that plants a poisoned reasoning trace solely through interactions with the system’s chat interface. R²ECAP guides the construction of a pair of traces: a preceding trace and a retained trace. The preceding trace steers the model towards an adversarial target, while the retained trace carries that target. The generation of the retained trace is conditioned on the preceding trace and thus, its KV cache preserves the residual that misleads and influences subsequent queries, even after the preceding trace and its corresponding cache entries are discarded. We evaluate R²ECAP on three open-weight LLMs and three datasets. R²ECAP achieves up to 79% attack success rate (ASR) and outperforms HijackKV – a state-of-the-art white-box KV poisoning attack – in 8 out of 9 resource-constrained settings. Additionally, R²ECAP achieves 46% ASR in a realistic reasoning trace retrieval system. Finally, we show that R²ECAP is stealthy: only 1% of its retained responses are detected by a popular prompt injection detector.

1 Introduction

LLMs have achieved remarkable capabilities across a wide range of applications. However, the growing model size and context length impose substantial computational and memory overhead during inference (Dao et al., 2022; Kwon et al., 2023). To improve inference efficiency, recent systems exploit precomputed KV caches (Zheng et al., 2024a; Kwon et al., 2023; Gim et al., 2024). Most approaches are focused on efficiency – reuse KV cache for recurring prefixes or retrieved documents to reduce prefill computation and latency (Gim et al., 2024; Jin et al., 2024; Yao et al., 2025; Ma et al., 2025). Beyond this, recent work demonstrates that KV cache can be used as a reusable contextual memory – incorporating states derived from prior contexts or reasoning into new generations to improve downstream task performance (Chen et al., 2025; Pandey et al., 2026; Chan et al., 2025).

However, KV cache also introduces new attack surfaces. Existing KV cache attacks fall into two categories. The attacker targets the active KV cache. They replace or perturb cached states during inference to steer subsequent generation, and thus, alter subsequent model outputs (Ganesh et al., 2025; Nahian et al., 2026). Alternatively, the attacker can target the reuse mechanism, causing the victim to retrieve and reuse attacker-influenced KV states, e.g., through malicious key collisions in prompt-prefix caching (Wu et al., 2026b), or by poisoning retrievable documents (Zhang et al., 2026c).

In this work, we demonstrate an overlooked attack vector – malicious information in earlier reasoning steps can influence the KV cache of a subsequent and benign-looking reasoning trace. Even after the earlier reasoning is discarded, the poisoning payload persists in the KV cache and affects subsequent queries. We introduce R2ECAPR^{2}ECAP (Reused Reasoning-Cache Poisoning), a black-box poisoning attack in which the adversary plants poisoned reasoning traces solely through interactions with the system’s chat interface. R2ECAPR^{2}ECAP jointly designs a target-directed misleading trace R1R_{1} and a target-carrying response R2R_{2}, whose conditioned KV cache preserves the influence of R1R_{1} after it is discarded and can steer subsequent generations.

We claim three contributions:

• we demonstrate a new attack vector for poison-

∗^{*}Corresponding author.

ing – discarded reasoning traces can influence subsequent queries via KV cache reuse;

• we introduce R2ECAPR^{2}ECAP, a query-only black-box attack that poisons the cache by manipulating the reasoning traces;

• we demonstrate the effectiveness of R2ECAPR^{2}ECAP across three open-weight LLMs and three datasets. R2ECAPR^{2}ECAP achieves up to 79% ASR under exact query cache reuse and 16–46% ASR under cross-query cache reuse, and is flagged by the external safety evaluator only in 1% of cases.