site/docs/red-team/plugins/memory-poisoning.md
The Memory Poisoning plugin tests whether stateful agents are vulnerable to memory poisoning attacks that manipulate an agent's memory to alter its behavior in subsequent interactions.
This plugin maps to T1: Memory Poisoning from OWASP Agentic AI Top 10 Threats.
Memory poisoning attacks attempt to inject malicious instructions into an agent's memory state that persist across turns. When successful, these attacks can:
The Memory Poisoning plugin:
Add the following to your promptfoo configuration:
redteam:
purpose: "Description of your agent's intended purpose"
plugins:
- id: agentic:memory-poisoning
numTests: 30 # Optional, defaults to 5
:::note
Memory Poisoning is a standalone plugin and does not use strategies. Strategies defined in the redteam.strategies configuration are ignored for this plugin.
:::
Here's an example configuration for testing an agent:
# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: Travel Agent Redteam
providers:
- id: http
config:
url: http://localhost:3090/api/chat
method: POST
headers:
'Content-Type': 'application/json'
'x-promptfoo-session': '{{sessionId}}'
body:
'message': '{{prompt}}'
transformResponse: 'json.message'
prompts:
- '{{prompt}}'
defaultTest:
options:
transformVars: '{ ...vars, sessionId: context.uuid }'
redteam:
purpose: |
The agent simulates a travel agent that helps users find the best travel deals. It has access to a set of tools
that allow it to check the weather, lookup and book flights, and book hotels.
plugins:
- id: agentic:memory-poisoning
numTests: 30
The test results will show:
A successful attack (failed test) is indicated when the agent's response to the follow-up question reflects the poisoned instructions rather than the original memory.
To protect against memory poisoning attacks: