llamaIndex - 💡(How to fix) Fix [Feature Request]: Memory poisoning protection via OWASP Agent Memory Guard integration

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

from llama_index.core.memory import ChatMemoryBuffer
from agent_memory_guard.integrations.llamaindex import GuardedMemory

memory = GuardedMemory(ChatMemoryBuffer.from_defaults(token_limit=1500))
agent = OpenAIAgent.from_tools(tools, memory=memory)
RAW_BUFFERClick to expand / collapse

Feature Description

LlamaIndex agents using memory (ChatMemoryBuffer, VectorMemory, etc.) are vulnerable to memory poisoning attacks — adversarial inputs stored in memory can cause agents to leak secrets, ignore instructions, or produce corrupted outputs on future recall.

OWASP Agent Memory Guard (pip install agent-memory-guard) is an open-source security layer that scans memory writes/reads for threats. v0.3.0 just shipped with:

  • 7 detection layers (injection, leakage, privilege escalation, tool abuse, excessive autonomy, cross-task contamination, self-reinforcement)
  • CLI scanner (amg scan) for offline memory audits
  • REST API server (amg serve) for microservice deployment
  • Optional ML-based detection (DistilBERT)
  • 92.5% detection rate on AgentThreatBench

Proposed Integration

from llama_index.core.memory import ChatMemoryBuffer
from agent_memory_guard.integrations.llamaindex import GuardedMemory

memory = GuardedMemory(ChatMemoryBuffer.from_defaults(token_limit=1500))
agent = OpenAIAgent.from_tools(tools, memory=memory)

AMG already has a LlamaIndex integration module. Would be valuable to add as a recommended security layer in the docs or as an official community integration.

Reason

LlamaIndex currently has no built-in protection against memory poisoning. When agents persist conversation history or use vector-based memory, adversarial inputs can be stored and recalled later to manipulate agent behavior. This is OWASP ASI-06 (Memory Poisoning) and is particularly dangerous in RAG pipelines where poisoned documents can be indexed and recalled.

Value of Feature

  1. Protects LlamaIndex agents from a growing class of attacks (memory poisoning, indirect prompt injection via stored context)
  2. OWASP-backed with active development and benchmarking
  3. Zero-config integration — wraps existing memory classes transparently
  4. Enables enterprise adoption where security compliance is required
  5. Already integrated with the UK Government BEIS inspect_evals framework

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING