c5.3 Prevent agent memory poisoning
Stop attackers from corrupting an agent's persistent memory to influence its future behavior, by protecting session identifiers and validating what is written to memory.
Implementation guidance
How to implement on AWS
Ensure users cannot modify their session ID or actor ID, and never place ActorID/SessionID in system prompts where they could be manipulated. Add input validation (e.g. a pre-processing Lambda) that rejects attempts to inject false information intended to corrupt agent memory.
Acceptance criteria
Session/actor IDs are server-controlled and absent from prompts; memory writes are validated; a memory-poisoning attempt is rejected.
Practical implementation
How this control is implemented in each reference architecture:
Session/actor IDs are set server-side (never in prompts) and a validation layer rejects attempts to write false information into the agent's memory in the Generative AI account.
- Ensure users cannot modify their session ID or actor ID; set them server-side and never place ActorID/SessionID in system prompts where they could be manipulated.
- Add a pre-processing Lambda that validates memory writes and rejects attempts to inject false information intended to corrupt agent memory.
- Alarm on repeated rejected memory writes as a poisoning signal.
How to validate: Session/actor IDs are server-controlled and absent from prompts; memory writes are validated; a memory-poisoning attempt is rejected.
Avoid: Trusting the model or client to supply the actor/session ID. That lets a user reach another's memory; control identifiers server-side.
Server-controlled session/actor IDs and a validation layer on memory writes prevent poisoning within the account.
- Set session/actor IDs server-side and keep them out of system prompts.
- Validate memory writes with a pre-processing Lambda that rejects false-information injection.
- Alarm on repeated rejected writes.
How to validate: Session/actor IDs are server-controlled and absent from prompts; memory writes are validated; a poisoning attempt is rejected.
Avoid: Writing to agent memory without validation. A poisoned memory taints every future session; validate what is stored.
Threats addressed
- Memory poisoning: injecting false information that taints future sessions.
- Users manipulating their session/actor ID to reach other data.
AWS services
Framework mappings
OWASP GenAI/LLM Top 10 (2026)
- LLM01 Prompt Injection
- LLM05 Data and Model Poisoning
NIST AI Risk Management Framework (AI 100-1)
- MANAGE.1 AI risks are prioritized, responded to and managed
AWS Well-Architected Generative AI Lens (Security)
- GENSEC06-BP01 Implement data purification filters for model training workflows
- GENSEC05-BP01 Implement least privilege and permission boundaries for agentic workflows
OWASP GenAI Top 10 for Agentic Applications (2025)
- ASI06 Memory and Context Poisoning
Watch
Learning resources
References
- AWS SRA for AI — Capability 5, Data protection
AI Security Maturity Model