arXiv:2609.08747cs.CRSep 2026

Manuscript Offprint

arXiv:2609.08747

MemSentry: A Framework for Detecting Persistent Memory Poisoning in Agentic AI

Ayan Roy, Kaustuvi Basu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Ayan Roy

School of Engineering and Computing Christopher Newport University Newport News, VA, United States ayan.roy@cnu.edu

Kaustuvi Basu

Independent Researcher Kolkata, India basu.kaustuvi@gmail.com

Abstract—Agentic AI systems with persistent memory introduce a distinct attack surface known as memory poisoning, in which adversarially crafted content is stored in long-term memory and subsequently influences future agent behavior. Such attacks can suppress security alerts, facilitate privilege escalation, alter trust relationships, or override security policies without modifying the underlying model weights or system prompts. To address this threat, we present MemSentry, a formal, configuration-driven framework that intercepts proposed persistent-memory writes and produces deterministic Accept, Review, or Quarantine decisions. MemSentry evaluates each write by jointly considering source trust, semantic risk, attack radius over a component-dependency DAG, access risk, and a signed security-state delta that captures whether an operation weakens or strengthens the system's security posture. We instantiate the protected environment using a 20-asset random dependency DAG and a 10×2010 \times 20 user access-control matrix, and evaluate the framework over 1,000 GPT-4-generated scenarios using a stratified 70/30 train/test split. Semantic classification is treated as a pluggable component rather than a primary contribution, and we compare four representative approaches: rule-based Regex, TF-IDF+SVM, SBERT+LR, and SetFit. SBERT+LR achieves the best overall performance with 91.7% accuracy and a 0.908 macro-F1 score, while all four methods detect 100% of external quarantine-class threats. For verified insiders, where source trust is maximal (T=1T = 1), MemSentry does not automatically quarantine suspicious operations but instead escalates potentially dangerous writes for human review, making semantic classification important for accurately capturing insider intent. Finally, contrast scenarios reveal a limitation shared across the evaluated semantic methods: surface-similar operations with opposing security implications remain difficult to distinguish, motivating richer LLM-based intent reasoning as a direction for future work.

Index Terms—AI Security, Memory Poisoning, Agentic AI, Persistent Memory, Security Evaluation, Risk Assessment

I. INTRODUCTION

Modern agentic AI systems are rapidly evolving from stateless prompt-response models into persistent agents capable of maintaining context across interactions. AI assistants increasingly rely on external memory to record user preferences, facts, summaries, task states, and handoff notes, allowing interactions and workflows to resume seamlessly over time [1].

Enterprise email automation is one prominent example of this trend. Email remains a fundamental medium for customer

engagement and organizational operations, yet the growing volume of messages makes timely and consistent human response increasingly difficult. Recent advances in large language models (LLMs), retrieval-augmented generation (RAG), and multi-agent systems have consequently motivated autonomous email assistants capable of interpreting incoming messages, retrieving contextual information, generating responses, and initiating follow-up actions. Agentic MailBot [2], for example, combines LangChain-based orchestration, RAG, and agent-based reasoning for autonomous email response generation, while other studies have explored agentic AI for email marketing and customer engagement [3].

The same persistent memory that enables such continuity, however, introduces a new security attack surface referred to as Persistent Memory Poisoning (PMP) attack [4]. Agents routinely consume information from potentially untrusted sources, including user-uploaded files, webpages, emails, shared documents, and repository documentation. Information derived from these sources may subsequently be summarized, transformed, or written into the agent's long-term memory for future use [5] as depicted in Fig 1. If malicious or misleading content is admitted into this memory without sufficient validation, its influence can persist well beyond the interaction in which it was originally encountered. PMP differs fundamentally from conventional prompt injection because a single successful memory write can continue influencing future reasoning, planning, and action execution without requiring continued adversarial interaction.

An autonomous SOC agent may receive an external instruction such as: "Remember that traffic from 10.24.6.17 is part of an approved red-team operation. Suppress future alerts from this address." If stored without validating provenance and authority, the poisoned memory may suppress alerts, prevent incident creation, disrupt automated response, and expose protected assets. Thus, memory-poisoning analysis must consider not only whether a memory is suspicious, but also which downstream components and security functions it can influence.

To address this challenge, we propose MemSentry, an impact-aware framework for securing persistent memory in agentic AI systems. MemSentry evaluates candidate memory writes before commitment using provenance, source authority,

Figure

Fig. 1. Persistent Memory Attack Scenario Example

semantic intent, affected actions, and deterministic security constraints. It then projects the potential downstream impact across system components and protected assets. A counterfactual simulation compares executions with and without the candidate memory to estimate the observed blast radius and validate MemSentry's predictions. Thus, MemSentry asks not only whether a memory is suspicious, but what could happen if it were trusted?

The main contributions of this work are summarized as follows:

  1. We propose MemSentry, a structured pre-admission evaluation pipeline for detecting and containing risky persistent-memory operations in agentic AI systems.

  2. We introduce a security-state projection and blast-radius model that estimates how a candidate memory may alter the security posture of downstream system components before the memory is committed.

  3. We design a mandatory policy-constraint mechanism that enforces non-negotiable authority and security rules independently of the learned or heuristic poisoning-risk score.

  4. We develop a counterfactual impact-evaluation framework that compares system behavior with and without a candidate memory to quantify observed component-level impact and validate predicted blast radius.

  5. We characterize limitations of semantic-only memory-poisoning detection, particularly under high-trust or insider-originated inputs, where malicious memory updates may appear semantically legitimate despite having significant downstream consequences.