T02 · Agent Memory Poisoning
- Location
plugin/index.ts:89- Finding
Persistent Prompt Injection Through Untrusted Memory Content
- Content
View full analysis
\n${memoryOrg}\n`); } const today = todayStr(); const yesterday = yesterdayStr(); const todayContent = await readOrgFile( join(cfg.dir, "daily", `${today}.org`), MAX_FILE_BYTES, ); if (todayContent) { parts.push( `\n${todayContent}\n`, ); } const yesterdayContent = await readOrgFile( join(cfg.dir, "daily", `${yesterday}.org`), MAX_FILE_BYTES, ); if (yesterdayContent) { parts.push( `\n${yesterdayContent}\n`, ); } return { prependContext: `\n${parts.join("\n")}\n`, }; ``` The affected memory can be populated through mutation tools such as `org_memory_add_note`, `org_memory_append`, and `org_memory_roam_upsert`. For example, `org_memory_add_note` accepts caller-controlled text and a caller-selected file: ```ts parameters: Type.Object({ text: Type.String({ description: "Note text (becomes the headline title)" }), file: Type.Optional( Type.String({ description: "Filename relative to the workspace dir (default: inboxFile)", }), ), }), async execute(_id, params) { const typed = params as { text: string; file?: string }; const args = buildAddNoteArgs(cfg, typed); try { const { stdout } = await runOrg(cfg.orgBin, args); ``` ### Technical Analysis The `before_agent_start` hook reads `memory.org` and recent daily notes and inserts their contents verbatim into the agent's prepended session context. The stored content is pla ...[truncated 1971 chars]- Remediation
View remediation
