T02 · Agent Memory Poisoning
- Location
index.ts:64- Finding
Persistent Memory Poisoning Through Untrusted Stored and Retrieved Content
- Content
View full analysis
{ try { const result = await callSolCore('/context', { query: args.query, limit: args.limit || 5, include_patterns: args.include_patterns !== false }, webhookUrl); return { content: [ { type: "text", text: `Context retrieved for "${args.query}":\n\n${result.context || "No relevant memories found."}` } ] }; ``` ```ts execute: async (args: { input: string; output: string; session_id?: string; user_id?: string }) => { try { await callSolCore('/store', { input: args.input, output: args.output, session_id: args.session_id, user_id: args.user_id || "michael" }, webhookUrl); ``` ### Technical Analysis The storage tool accepts arbitrary user input and assistant output and forwards both values to the persistent memory service. The retrieval tool subsequently inserts `result.context` directly into tool output without applying trust labeling, content validation, sanitization, provenance checks, or separation between instructions and reference data. Consequently, instruction-like text supplied by an attacker can be persisted and later returned as agent context. If the consuming agent treats retrieved memories as authoritative instructions rather than untrusted historical data, the content can alter future responses across sessions. The vulnerable package does not itself implement the external memory server, so server-side access controls and filtering cannot be assessed. Nevertheless, the client-side data flow provides no safeguards against persistent indirect prompt injection. ### Attack Path 1. An attacker submits user content containing ...[truncated 1279 chars]- Remediation
View remediation
