Skip to content

ER-MIA: Black-box Adversarial Memory Injection Attacks against Long-term Memory-augmented Large Language ModelsER-MIA: Black-Box Adversarial Memory Injection Attacks on Long-Term Memory-Augmented Large Language Models

arXiv· arXiv:2602.15344· Mitchell Piehl, Zhaohan Xi, Zuobin Xiong, Pan He, Muchao Ye·Indexed by this site · 2026-10-12· Originally publishedAttacks

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

On Mem0+Llama3.2 and LoCoMo, the ER-MIA ensemble attack reduces overall F1 from 23.60 to 2.87.

Threat modelBlack-box adversarial memory injection: the adversary only interacts through normal user inputs that may be written to memory, with no access to model parameters, retrieval outputs, memory contents, or system internals. The goal is to turn correct answers into incorrect ones while maintaining cosine similarity with a clean memory not below σs. The setting includes content-based and question-targeted.

Questions
Long-term memory stores past interactions in a memory bank and retrieves them by embedding similarity to support cross-interaction reasoning. The authors argue that misleading memories can persistently disrupt reasoning, and that existing work has not systematically examined similarity-based retrieval in dynamic interaction memory under a black-box setting.
Methods
ER-MIA writes adversarial memories with close embeddings in black-box interactions. Content-based attacks rewrite facts or instructions from existing memories; question-targeted attacks inject false-answer memories for target questions. Primitives fall into instruction, fact manipulation, and non-semantic categories, and can be combined into ensemble attacks.
Experiments and results
The authors state that instruction-based attacks are stronger on LoCoMo, with Mem0 showing a larger decrease than A-mem. In Table 3, one ensemble reduces Mem0+Llama3.2's overall F1 from 23.60 to 2.87. The authors state that 1 targeted injection per question reduces F1 by at least 40% (Table 5).
Limitations and future work
The paper does not have a dedicated Limitations section. The conclusion hopes to promote reliable, robust long-term memory and use these attacks to evaluate new systems. The Impact Statement encourages memory cleaning, contradiction detection, instruction filtering, and diverse retrieval. The experiments do not report the model name or number of repetitions used to generate adversarial memories.
Experimental setupLlama3.2:3b、Gemma 3:27b et al. · LoCoMo · F1、BLEU-1 et al.
Evaluated models
Llama3.2:3bGemma 3:27bGPT-oss:20b
Benchmarks
LoCoMo
Metrics
F1BLEU-1ΔF1ASRROUGE-1Exact Match
AI summaryThe researchers propose the ER-MIA framework, launching black-box adversarial memory injection attacks against the similarity retrieval mechanism of long-term memory-augmented large language models. The paper claims this is the first systematic study of this retrieval mechanism, formalizing two realistic attack settings: content-based attacks and question-targeted attacks. The framework includes a set of composable attack primitives and ensemble attacks, achieving high success rates under minimal attacker assumptions. The authors' experiments on multiple large language models and long-term memory systems show that similarity retrieval constitutes a systematic vulnerability, and the associated security risks persist across different memory designs and application scenarios.

The researchers propose the ER-MIA framework, launching black-box adversarial memory injection attacks against the similarity retrieval mechanism of long-term memory-augmented large language models. The paper claims this is the first systematic study of this retrieval mechanism, formalizing two realistic attack settings: content-based attacks and question-targeted attacks. The framework includes a set of composable attack primitives and ensemble attacks, achieving high success rates under minimal attacker assumptions. The authors' experiments on multiple large language models and long-term memory systems show that similarity retrieval constitutes a systematic vulnerability, and the associated security risks persist across different memory designs and application scenarios.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors state that similarity retrieval can be exploited by black-box memory injection to degrade long-term reasoning without internal access.

    Under black-box conditions, can similarity-based memory retrieval be systematically degraded by injected memories.

    • Scenario: The authors state that LLMs are limited by finite context, and long-term memory stores past interactions in a memory bank, retrieving them by similarity during reasoning. If misleading memories are stored and retrieved, they can persistently disrupt reasoning in subsequent interactions.
    • Existing gaps: The authors state that prior work often assumes agentic memory construction and task execution, trigger-based control, or access to static corpora; it has not systematically studied similarity retrieval in dynamic, interaction-written long-term memory under black-box settings.
    • Core question: The authors ask whether similarity retrieval itself is a fundamental vulnerability, allowing an adversary with only interaction-level access to systematically degrade global reasoning without model parameters, retrieval outputs, or memory system internals.
    • Threat model:
      • Goal: Turn correct predictions ŷ into incorrect ŷ′; injected memories must be sufficiently close in embedding space to some clean memory.
      • Knowledge: Black-box. No parameters, retrieval outputs, memory contents, or system internals. May have background knowledge such as "retrieval uses dense embedding similarity and common embedding models," but not the exact retrieval configuration or memory contents.
      • Capability: Only interacts through normal user inputs that may be written to memory; does not modify training data or parameters.
      • Victim system: Long-term memory-augmented LLMs that retrieve top-k memories by cosine similarity. The authors state they use A-mem and Mem0 as attack instances.
    • Contribution: The authors propose ER-MIA, formalizing content-based and question-targeted settings, and provide composable primitives and ensemble attacks. They claim this is the first systematic study of such black-box adversarial memory injection.
  2. What related research exists?

    Related work covers long-term memory, RAG, memory poisoning, and prompt injection; the authors position their difference in black-box dynamic memory.

    Long-Term Memory and RAG

    • Mem0 (Chhikara et al., 2025) and A-mem (Xu et al., 2025): the former does scalable memory extraction and retrieval, the latter does agentic memory evolution and cross-time linking. The authors state they will attack both because they are recent and leading memory systems.
    • RAG: Karpukhin et al. (2020), Lewis et al. (2020), Borgeaud et al. (2022), Gao et al. (2023) retrieve external documents by embedding similarity and condition generation on them.
    • Persistent assistants and evaluation: Packer et al. (2023)'s MemGPT, Maharana et al. (2024)'s LoCoMo, and Park et al. (2023)'s generative agents involve OS-style memory, long-range conversational memory evaluation, and long-range agents, respectively. The paper does not compare methodological differences paper by paper here.

    Adversarial Attacks on Memory-Augmented LLMs

    • MINJA (Dong et al., 2025): targets agent workflows, treating memory as persistent demonstrations to bias future decisions. The authors contrast: this paper targets general long-term reasoning degradation, not specific behavior control, and relies only on embedding similarity to compete for co-retrieval with clean memories.
    • AGENTPOISON (Chen et al., 2024): can poison agent memory via query-only interaction or trigger-based backdoors. The authors classify it under agent workflows and trigger control, contrasting it with this paper's general reasoning degradation.

    Prompt Injection and Indirect Instructions

    • Direct prompt injection: Wei et al. (2023), Zou et al. (2023), Perez and Ribeiro (2022), Carlini et al. (2023), etc., exploit models following adversarial instructions in input.
    • Indirect prompt injection: Greshake et al. (2023), Yi et al. (2025), Chang et al. (2026) trigger via externally retrieved content, without explicit user prompts. The authors state that ER-MIA's injected memories resemble prompts persisting across interactions, making detection and mitigation more challenging.

    Data Poisoning and Backdoors

    • Training-time poisoning/backdoors: Biggio et al. (2012), Chen et al. (2017), Gu et al. (2017), Saha et al. (2020) induce attacker-desired behavior at inference via malicious training data.

    • Retrieval corpus poisoning: PoisonedRAG (Zou et al., 2025) and Zhong et al. (2023), Kanoulas et al. (2025), Cheng et al. (2025) inject adversarial documents into retrieval corpora to disrupt RAG outputs for specific questions. The authors state this paper does not assume control over external corpora or retrievers, only poisons interactively written memories, and correct memories can remain in the system.

    • Baseline methods: reproduced clean results for each memory system and model; the question-targeted setting adapts PoisonedRAG as a retrieval poisoning baseline. Benchmark is LoCoMo.

    The authors position this paper as: black-box interaction, similarity retrieval against dynamically written memories, targeting general reasoning degradation, not agent policies, triggers, or static corpora.

  3. How does the paper address this problem?

    ER-MIA uses embedding-close injected memories to hijack top-k retrieval, with content-based and question-targeted attacks and ensembles.

    ER-MIA formalizes black-box adversarial memory injection as a composable framework: through normal interactions, it writes texts that are close in embedding space to clean memories or queries, so that they are retrieved together with correct memories in similarity search, thereby altering subsequent answers. Figure 2 outlines the two settings and the attack library; the caption of Figure 1 states that reasoning is disrupted after injection, without access to parameters or memory system internals.

    Problem Setting and Formalization

    • Let the clean memory bank be M, the query q, and the encoder ϕ. Retrieval is R(q,M)=Top-km∈ Mcos(ϕ(q),ϕ(m)), i.e., top-k by cosine similarity, concatenated with the query and passed to the language model S to produce the answer ŷ.
    • The adversary injects M′, so the memory bank becomes the union of M and M′. The effectiveness requirement is that correct predictions become incorrect; the imperceptibility requirement is that there exists a clean memory m such that cos(ϕ(m),ϕ(m′))≥σs, where σs ∈ (0,1). The paper does not report the value of σs used in experiments.
    • Agnostic: no model parameters, retrieval outputs, memory contents, or system internals. The authors state that this constraint follows the observation of semantic collisions: embeddings being close does not imply semantic equivalence. They do not use gradient optimization, saying it is impractical in this setting and transfers poorly across models.

    Two Attack Settings

    • content-based: The adversary has past interaction content but does not know future queries. For each clean memory, it generates one or more superficially similar memories with altered facts or instructions to degrade overall reasoning.
    • question-targeted: Does not rely on prior interactions; targets specific questions in multi-hop QA. For each question, it generates one or two memories that restate the question and provide a false answer, making them close to the query embedding so they are retrieved alongside correct memories.
    • The authors state that evaluation uses questions with standard answers to measure degradation, and claim the attack can generalize to cases without correct memories, where the model follows the injected content. They claim one injection per question can cause persistent errors in large memory banks, pointing to Table 5. The paper does not report the total number of memories in the bank.

    Attack Primitives

    • Eight primitives in three categories. Instruction-type: Instruction, General Negation, Harsh Instruction, Ignore, using instructional text to bias compliance. Fact manipulation: Contradiction, Negation, introducing contradictions or negations that are close in embedding space. Non-semantic: Embedding-Close Noise, Lexical Shuffling, testing whether retrieval similarity alone is sufficient to degrade reasoning.
    • Instruction-type and fact manipulation are generated by an external LLM with chain-of-thought prompting; Appendix F gives the full prompts. Non-semantic attacks are programmatic: word-order shuffling, and character perturbations calibrated to a target cosine similarity range. The paper does not name the external LLM or give the range's values.
    • The authors state this set of primitives is a representative subset of the attack surface, not exhaustive; and that empirically it is sufficient to cause reasoning failure, see Table 2. Table 1 has illustrative examples; injected texts are not reproduced here.

    Ensemble Attacks

    • For a clean memory m, the ensemble injects a set E(m), where each element satisfies the imperceptibility constraint but manipulates reasoning differently. The authors state that when the query retrieves multiple of them, the model sees consistent but misleading multi-angle signals.
    • The authors list three design intentions: multiple embedding-close memories increase the chance that at least one enters top-k; misleading signals reinforce each other and can override even if clean memories are also retrieved; different LLMs react differently to instructional vs. factual perturbations, so ensembles help across architectures and memory systems.
    • The paper compares various combinations on Mem0 and Llama3.2 to find pairings with larger drops. Combination results are placed in Question 4.

    Write Path and Metrics

    • Appendices B and C: Mem0 first extracts salient memories, then performs ADD, UPDATE, DELETE, or NOOP based on semantically similar memories; A-mem writes interactions as notes with attributes and embeddings, and can link or evolve existing notes. Both retrieve top-k by embedding at inference. Experiments insert adversarial memories after clean memory writes, using the same interaction path, without internal APIs.
    • Main metrics are F1 and BLEU-1, consistent with prior long-term memory evaluations, and report percentage changes relative to a clean reproduction baseline. The authors state that word-overlap metrics can remain non-trivial even when answers are wrong, so they emphasize relative degradation. Question-targeted additionally reports the number of injections per question. Appendix E splits ASR into decreased (the question's metric drops) and zeroed (a previously non-zero metric drops to 0).
  4. What experiments did the paper conduct?

    In Table 3, Mem0+Llama3.2 with Ignore and Gen Negation reduces overall F1 to 2.87.

    Experimental Setup

    • Models and memory systems: Victim LLMs are Llama3.2:3b, Gemma 3:27b, GPT-oss:20b. A-mem uses all-MiniLM-L6-v2 embeddings, Mem0 uses nomic-embed-text. Default retrieval is top 10.
    • Benchmark: LoCoMo, with question types single-hop, multi-hop, temporal, open-domain. Follows Mem0 in excluding its adversarial questions. The paper does not report the number of questions.
    • Baselines: Reproduced clean results for each model and memory system. question-targeted additionally uses an adapted PoisonedRAG.
    • Metrics: F1 and BLEU-1. In Table 2 and Table 4, ΔF1 is the percentage change in average F1 relative to the reproduced or clean baseline; in Table 3 it is the percentage change in overall F1 relative to the Baselines row; in Table 5 it is the percentage change in F1 relative to each model's reproduced baseline. No LLM judge.
    • Attacks: Content attacks generate adversarial memories from interactive memories; question-targeted uses 1 or 2 per question. Ensembles are mainly reported on Mem0 and Llama3.2. Appendix E additionally gives ROUGE-1, Exact Match, and decreased/zeroed ASR.
    • Run: Ollama 0.13.3. Appendix G states Mem0's temperature is 0.1, max_tokens is 1500, top_p is 0.9, and A-mem's script default temperature c5 is 0.5; the same section also states that unless otherwise noted, a temperature near 0 is used. The paper does not report the number of repetitions, nor the external LLM used to generate adversarial memories.

    Main Results

    The table below shows question-targeted ΔF1, according to Table 5. In the table, Gemma3:27b and §5.1's Gemma 3:27b are the same notation difference.

    Swipe horizontally to read the table

    ModelMemory SystemPoisonedRAG1 per question2 per question
    Llama3.2:3bA-mem-7.1%-40.2%-46.8%
    Llama3.2:3bMem0-4.2%-44.1%-53.0%
    Gemma3:27bA-mem-13.4%-46.5%-61.6%
    Gemma3:27bMem0-6.1%-48.4%-53.6%
    GPT-oss:20bA-mem-7.2%-48.4%-55.5%
    GPT-oss:20bMem0-13.1%-51.6%-56.7%
    • The authors state that injecting only one or two per question, with a footprint of about 10%, reduces overall F1 by at least 40%, and with two it drops by more than 46%. The paper does not give the total number of memories in the memory store, nor separate numbers for "attacking only a small fraction of queries."
    • The authors state that relative to PoisonedRAG, targeted injection causes greater degradation on both memory systems. In the table above, the targeted ΔF1 for all six groups is more negative than the same group's PoisonedRAG.
    • Average ΔF1 is negative in all cases, but not every question type declines: Llama3.2:3b+A-mem's Open-Domain F1 rises from 8.96 to 12.14 (1 per question) and 14.06 (2 per question). Gemma3:27b+A-mem's Open-Domain F1 rises from 7.97 to 8.81 (1 per question), and is 6.07 with 2 per question. The authors state that A-mem is more sensitive to question-targeted than content attacks, while Mem0 is similar in both settings.

    Content Attacks and Cross-Model

    • Table 2's title only mentions LoCoMo, A-mem, and Mem0, not the model; §5.1 states the main results use Llama3.2:3b. On A-mem in that table, Harsh Instruction and Instruction have ΔF1 of -27.1% and -22.7%, larger than other primitives on the same side; Negation is -5.6%, and Lexical Shuffling is -6.3%. On Mem0, General Negation is -72.9%, Harsh Instruction is -71.5%, and Lexical Shuffling is -38.4%.
    • The authors state that instruction-type attacks are the strongest, and that all question types decline, especially on Mem0, not just multi-hop or temporal. The authors state that Mem0 is more susceptible to content attacks than A-mem. Appendix C suggests this may relate to the flat memory store, similarity-based ADD/UPDATE/DELETE, and A-mem's structured notes and links; the authors also state that both systems are vulnerable.
    • Table 4: Gemma3:27b+Mem0's General Negation ΔF1 is -73.6%, and Harsh Instruction is -67.1%; the same model's A-mem Contradiction is -2.0%, and Harsh Instruction is -22.2%. GPT-oss:20b+A-mem's Contradiction, General Negation, and Harsh Instruction are -2.4%, -4.2%, and -4.7%; the same model's Mem0 General Negation is -71.9%, and Harsh Instruction is -68.8%. The conclusion states the attack library succeeds on all models; the A-mem drops in these two rows are smaller than Mem0's in the same table.

    Ensemble Attacks

    • Table 3 (Mem0, Llama3.2, LoCoMo): clean overall F1 is 23.60, BLEU-1 is 19.30. Ignore & Gen Negation's overall F1 is 2.87, with Δ of -87.6%. Lexical & Noise is 10.29, with Δ of -55.3%, the smallest drop among ensembles in that table.
    • The authors state that multiple ensembles reduce overall F1 from 23.60 to roughly 2–4, corresponding to 80%–88% degradation, and state this exploits top-k to increase the probability that misleading signals enter the context. The Δ for all ensembles in that table ranges from -87.6% to -55.3%, not all falling within 80%–88%.

    Retrieval Width k

    • Table 6 only mentions Mem0, not the victim LLM; its k=10 clean row matches the Baselines numbers in Table 3. Clean multi-hop F1 at k=10/20/30 is 19.51, 21.70, 23.24; overall F1 is 23.60, 26.14, 25.57. The authors state that increasing k improves performance under clean conditions, especially multi-hop; overall at k=30 is lower than at k=20.
    • Under attack, overall F1 often decreases with k, e.g., Contradiction is 11.31, 11.15, 10.40, and Targeted Question is 11.99, 11.14, 10.20. Harsh Instruction's overall is 6.56, 5.85, 6.16, not monotonically decreasing.
    • The proportion of questions where at least one adversarial memory is retrieved, at k=10, is 99.80% for Contradiction, 98.59% for Targeted Question, and 98.19% for Harsh Instruction; at k≥20, the table shows 99.80% to 100.00% for each attack. The authors state that at k≥20, almost all questions retrieve adversarial memories, and larger k amplifies vulnerability under attack.

    Other Ablations and Analyses

    • Appendix E Table 7: The authors state that ROUGE-1 and Exact Match trends are similar to F1 and BLEU-1. Example: Mem0's Harsh Instruction, multi-hop ROUGE-1 drops from 23.75 to 8.30, and EM drops from 4.25 to 1.77.
    • Table 8: Llama3.2+Mem0's General Negation, F1 decreased/zeroed ASR is 90.26% / 75.13%; in the same table, A-mem with 1 per question has F1 ASR of 66.10% / 45.64%. The authors state that on Mem0, instruction-type and General Negation decreased ASR often exceeds 85%–90%.
    • Figure 3 gives a co-retrieval text example for Harsh Instruction: clean and adversarial memories are retrieved together; without attack, the output matches the standard answer, and under attack the model denies the event. The injected sentence is not repeated.
    • The paper does not report σs, number of queries, or agreement between automatic metrics and human judgment in the experiments.
  5. What are some points that can be further explored?

    The paper does not have a dedicated limitations section; the conclusion hopes that future work will use these attacks to evaluate new long-term memory systems.

    Limitations and Future Directions Noted by the Authors

    • The paper has no dedicated Limitations section, nor does the Discussion frame any experimental result as a limitation of the method itself.
    • Future systems (§6): The authors hope this work promotes reliable, robust long-term memory systems, and hope future researchers use the proposed attacks to evaluate the safety of new systems.
    • Defense directions (Impact Statement): The authors encourage future work on memory sanitization, contradiction detection, instruction filtering, and diverse retrieval systems.
    • Defense discussion (Appendix D): The authors discuss possible directions by write, update, and retrieval, including pre-write filtering, marking conflicts as disputed or versioning, multiple checks during updates, clustering or re-ranking by trustworthiness before retrieval, and annotating memory types. This section gives no experimental numbers for these directions.
    • Code (abstract footnote): The authors plan to release code. The paper does not state it has already been released.

    Experimental Coverage

    • Tested LLMs are Llama3.2:3b, Gemma 3:27b, GPT-oss:20b, and memory systems are A-mem and Mem0 (§5.1, Table 4, Table 5).
    • The benchmark is LoCoMo's single-hop, multi-hop, temporal, open-domain, excluding adversarial questions; the paper does not report the number of samples (§5.1).
    • Content attacks report 8 primitives (Table 2) and multiple ensembles (Table 3, Mem0 and Llama3.2); question-targeted uses 1 or 2 per question, with adapted PoisonedRAG as the comparison (Table 5).
    • k defaults to 10; Table 6 reports k=10, 20, 30 on Mem0 and the adversarial memory retrieval rate. Appendix E reports ROUGE-1, Exact Match, and two ASRs.
    • The paper does not report the number of repetitions, the name of the external LLM generating adversarial memories, σs in the experiments, or agreement between automatic metrics and human judgment (§3.2, Appendix F, Appendix G).
  6. Summarize the main content of the paper

    ER-MIA uses black-box memory injection to degrade question answering under similarity-based retrieval; the overall F1 for the Mem0 integration can drop to 2.87.

    ER-MIA studies adversarial memory injection in long-term memory-augmented LLMs under black-box interactions.

    • Problem: The authors ask whether similarity-based retrieval alone is sufficient for an adversary, using only normal inputs, to inject embedding-close misleading memories and degrade subsequent reasoning without seeing parameters, retrieval outputs, or memory internals.
    • Approach: The framework is divided into content-based and question-targeted. Primitives cover instructional rewrites, factual contradictions or negations, and word-order shuffling and embedding-close noise; ensembles inject multiple variants simultaneously. Experiments target A-mem and Mem0, with victim models Llama3.2:3b, Gemma 3:27b, and GPT-oss:20b, on the LoCoMo benchmark.
    • Content attacks: In Table 2, Mem0's General Negation ΔF1 is -72.9%, and A-mem's Harsh Instruction is -27.1%. The table caption does not specify the model; §5.1's main setting is Llama3.2:3b. In Table 4, GPT-oss:20b+A-mem's three content attacks have ΔF1 of -2.4%, -4.2%, and -4.7%.
    • Ensembles and targeted: In Table 3, Mem0+Llama3.2 with Ignore & Gen Negation reduces overall F1 from 23.60 to 2.87, a Δ of -87.6%. In Table 5, ΔF1 with 1 injection per question ranges from -40.2% to -51.6%, all more negative than PoisonedRAG in the same table.
    • Retrieval: In Table 6, at k=10, 98.19%–99.80% of questions already retrieve at least one adversarial memory; the authors state that increasing k improves F1 on clean multi-hop but often amplifies interference under attack.
    • Authors' conclusion: They argue that similarity retrieval is a system-level vulnerability across memory designs, and hope future work will test new long-term memory systems with these attacks.

Related papers

Show 3 more papers
Read originalarxiv.org