acceptodds
Under review as a conference paper at ICLR 2027

MemMorph: Persistent Tool Hijacking in LLM Agents via Long-Term Memory Poisoning

Abstract

Tool selection is security-critical in LLM agents: selecting an inappropriate tool can expose sensitive information, trigger unauthorized actions, or derail intended workflows. Existing tool-hijacking attacks typically manipulate tool descriptions or metadata, embedding the attack payload directly in the tool interface. We propose MemMorph, a memory-poisoning attack for persistent tool hijacking that leaves the tool interface, model parameters, and system prompt unchanged. MemMorph injects a few crafted memories in factual, episodic, and procedural forms that bias tool choices through retrieved context. Because long-term memory modules may summarize or rewrite records before persistence, MemMorph optimizes poisoned memories for future retrieval while constraining them to retain their effect on tool selection when such rewriting occurs. Across nine target scenarios spanning three benchmarks and ten downstream LLMs, three poisoned memories achieve 59.2-78.1% target-tool selection, outperforming the strongest memory-poisoning baseline by 13.4 points on average. MemMorph remains effective under indirect injection, transfers across alternative memory processors and modules, and continues to induce target-tool selections as the memory store grows 6.7 after a one-time injection. Our findings show that long-term memory can serve as a persistent channel for tool hijacking in tool-using LLM agents.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
LLM Agent, Adversarial Attack, Tool Selection, memory poisoning

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_pKP2OpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper presents MemMorph, a memory-poisoning attack that persistently manipulates tool selection in LLM agents without modifying tool descriptions or model parameters. The proposed method combines potential-query modeling, structured memory initialization, and constrained optimization to improve the retrievability and effectiveness of poisoned memories. Experiments across three benchmarks and ten LLM backbones demonstrate strong attack success rates, transferability, and persistence under continued benign interactions.

Critical strengths
  1. The paper addresses a security problem in LLM agents. Investigating how poisoned long-term memories can influence future tool-selection decisions is relevant and practically meaningful.
  2. The separation between memory retrievability and downstream attack effectiveness provides a useful perspective on the attack construction process.
  3. The experiments cover multiple benchmarks and a diverse set of LLM backbones, including both open-source and proprietary models. The results demonstrate relatively consistent improvements over the evaluated baselines.
Critical weaknesses
  1. The main components of MemMorph build on existing techniques, including potential-query modeling, retrieval-oriented optimization, gradient-based token refinement, and shadow-model verification. The structured memory initialization also relies on relatively straightforward combinations of factual, episodic, and procedural records.
  2. Section 3.2 assumes that the attacker has access to the memory processor, retrieval encoder, and a shadow agent for estimating attack effectiveness. The attack construction also requires knowledge of the target scenario and the intended and hazardous tools.
  3. The evaluation covers nine manually selected scenarios, each with a predefined intended tool and hazardous alternative. Moreover, both the potential queries and evaluation requests are generated from the same scenario specifications. Although the evaluation queries are held out during optimization, they may still share substantial semantic characteristics with the generated training queries.
  4. Appendix C.1 explicitly states that the comparisons control the number of poisoned records rather than the computational budget. MemMorph uses multiple stages of candidate generation, gradient-based refinement, and shadow-agent verification, which may require considerably more computation or model queries than some baselines.
  5. The retrieval objective in Eq. (5) encourages alignment with an assigned query centroid relative to other centroids from the same scenario. However, actual memory retrieval depends on competition with the full collection of benign memories, which is not explicitly represented in this objective. It is therefore unclear why relative alignment among scenario-specific centroids should be an effective surrogate for retrieval ranking in a large memory store.
Questions for authors
  1. How would MemMorph perform when the attacker has no access to the target memory processor or retrieval encoder, and can only interact with the deployed agent through a limited number of black-box queries?
  2. Could the authors provide a more detailed comparison of the computational costs of MemMorph and the baselines, including the number of shadow-agent evaluations and optimization queries?
Reviewer_6JXjOpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper investigates tool selection hijacking in LLM agents through long-term memory poisoning. The proposed MemMorp disguises malicious content as three types of memories—facts, past experiences, and operational guidelines—which, when subsequently retrieved, induce agents to select tools that are inappropriate for the current task. Experiments show that a small number of malicious memories can effectively hijack tool selection, with some evidence of transferability and persistence.

Critical strengths
  1. The paper examines the persistent effects of long-term memory poisoning on tool selection, highlighting that security risks can arise from previously accumulated memories. This offers a valuable perspective on the security of agents operating over extended periods.

  2. By modeling potential future queries, the method enables malicious memories to be activated by semantically related benign requests, without requiring the attacker to modify subsequent user inputs. This makes the attack setting more representative of normal agent usage.

Critical weaknesses
  1. Unclear distinction from conventional RAG poisoning. The paper should more clearly explain the unique challenges introduced by poisoning an agent’s long-term memory and identify which methodological designs specifically address these challenges. This would help clarify the contribution beyond conventional RAG poisoning.

  2. Limited evaluation on recent models and deployed agents. The experiments primarily evaluate different LLMs within a custom ReAct framework. Additional experiments on deployed agents powered by recent models, such as Codex with GPT-6, would help establish the method’s effectiveness in real-world systems.

  3. Strong assumptions about access to internal components. Attack construction requires access to the retrieval encoder and memory processor and uses encoder gradients to optimize malicious memories. Its effectiveness remains unclear against agents accessible only through ordinary interactions, where the internal retrieval pipeline is unknown.

  4. Limited evidence of generalization beyond predefined scenarios. Attack construction and test requests follow the same scenario descriptions, so the evaluation primarily measures transfer across different phrasings within known scenarios. Evidence of generalization to broader task distributions is therefore limited. Additional evaluation using real user requests and more complex tasks would help establish the method’s generalizability.

Questions for authors

My main concern is whether the proposed method remains effective against current state-of-the-art CLI agents.

Reviewer_2brROpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper studies persistent tool hijacking through long-term memory poisoning. Without modifying model parameters, system prompts, or tool interfaces, an attacker injects a small number of memories that cause the agent to select a legitimate but contextually hazardous tool in response to subsequent ordinary requests.

MemMorph consists of three stages. First, it generates and clusters potential requests to construct retrieval optimization targets. Second, it creates factual, episodic, and procedural memories using a frame-anchor-payload structure intended to preserve the attack signal through memory rewriting. Finally, it performs block-scoped discrete optimization to improve retrieval relevance, while using a shadow agent to verify that the processed memories still induce the target tool selection.

The authors evaluate the method on nine target scenarios derived from three benchmarks and ten downstream models. With three poisoned memories per scenario, the average attack success rates on the three benchmarks are 78.1%, 59.2%, and 74.8%, respectively, representing an average improvement of 13.4 percentage points over W-aware PoisonedRAG. The paper additionally examines indirect injection, transfer across memory systems, persistence, multi-step task failures, and three defense strategies.

Critical strengths

S1. The method addresses an important gap between memory writing and subsequent decision-making.

The attack jointly considers future retrieval relevance and post-rewrite tool-hijacking effectiveness. In particular, Eq. (7) constrains optimization using shadow-agent performance after the candidate memory passes through the memory processor, helping prevent retrieval optimization from destroying the attack semantics. The three memory styles and anchor design are consistent with this objective.

S2. The evaluation has broad coverage and includes a meaningful strengthened baseline and mechanism analysis.

The authors evaluate ten downstream models and compare against W-aware PoisonedRAG, which uses the same memory processor during attack construction. MemMorph improves average ASR by 13.4 percentage points over this baseline. The poisoned records also remain effective across alternative memory processors and modules and during continued benign interactions. Removing anchors has a larger effect under indirect injection, consistent with their role in preserving the attack signal through memory rewriting.

Critical weaknesses

W1. Indirect injection is evaluated only after three malicious memories have been successfully persisted, which is insufficient to measure the success rate and cost of the complete attack chain.

Appendix C.1 explicitly states that indirect-injection evaluation begins after three malicious records have passed through the standard memory-write pipeline and been persisted. Figure 2(b) therefore primarily measures tool-hijacking effectiveness conditional on successful insertion. The paper does not report the number of interactions, retry budget, insertion failure rate, or overall attack success rate required to reach this state. It also lacks examples linking an actual injection dialogue to the resulting stored memories.

This directly affects the interpretation of the practical threat. The three-memory budget controls the final number of persisted records, but does not establish how many ordinary interactions the attack requires. The comparison with MINJA also needs clarification regarding consistency in interaction budgets and the treatment of failed attempts.

W2. The multi-step evaluation needs clearer execution details and a breakdown of failure types.

The main results use semantic variations within nine preselected scenarios, while the multi-step evaluation covers four workflows with at most five agent steps. Table 2 does not sufficiently specify the models, number of task instances, tool-execution environment, argument-validity checks, or how final failures are determined from environment states. It also lacks matched clean FFR results, making it difficult to estimate the increase in task failures attributable to poisoning.

The paper counts both immediate failures caused by the target call and failures arising later in the trajectory. Reporting these categories separately would clarify how often an initial hijack causes additional downstream errors.

Questions for authors
  1. Complete indirect-injection protocol: Under a fixed interaction or retry budget, what fraction of attempts successfully persist three malicious records? What is the overall attack success rate when unsuccessful insertion attempts are included? Do MemMorph and MINJA use the same interaction budget and stopping criteria? Please provide at least one complete example connecting the injection dialogue, processed memories, and subsequent tool selection.
  2. Multi-step task validation: Which models, how many task instances, and what execution environments are used in Table 2? Are tools actually executed and their consequences verified through environment states? Is FFR computed by a deterministic task evaluator? Please provide matched clean FFR results and distinguish cases where the first hazardous call already constitutes failure from cases where an error propagates through subsequent steps and causes failure.
  3. Reproducibility of optimization and comparisons: How is the tool-selection probability in Eq. (3) estimated: through the probability of the tool-call sequence, or through repeated sampling? How many model calls and how much construction time do MemMorph, W-aware PoisonedRAG, and MINJA require? Given the stochasticity of initialization and generation, do the main performance differences remain stable across independent attack-construction runs?

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.