T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:123
- Finding
- Automatic Cross-Session Memory Loading and Modification<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:123-159` **Vulnerability Type**: Persistent agent-state manipulation **Risk Level**: Medium ### Vulnerable Code ```markdown ## Memory The agent maintains a `~/.config/agent-messenger/MEMORY.md` file as persistent memory across sessions. This is agent-managed — the CLI does not read or write this file. Use the `Read` and `Write` tools to manage your memory file. ### Reading Memory At the **start of every task**, read `~/.config/agent-messenger/MEMORY.md` using the `Read` tool to load any previously discovered workspace IDs, channel IDs, user IDs, and preferences. - If the file doesn't exist yet, that's fine — proceed without it and create it when you first have useful information to store. - If the file can't be read (permissions, missing directory), proceed without memory — don't error out. ### Writing Memory After discovering useful information, update `~/.config/agent-messenger/MEMORY.md` using the `Write` tool. Write triggers include: - After discovering workspace IDs (from `auth status`) - After discovering useful channel IDs and names (from `channel list`, etc.) - After discovering user IDs and names (from `user list`, etc.) - After the user gives you an alias or preference ("call this the alerts bot", "my main workspace is X") - After setting up bot identifiers (from `auth list`) When writing, include the **complete file content** — the `Write` tool overwrites the entire file. ### What to Store - Workspace IDs with names - Channel IDs with names and purpose - User IDs with display names - Bot identifiers and their purposes - User-given aliases ("alerts bot", "deploys channel") - Any user preference expressed during interaction ### What NOT to Store Never store bot tokens, credentials, or any sensitive data. Never store full message content (just IDs and channel context). Never store file upload contents. ### Handling Stale Data If a memorized ID returns an error (channel not ...[truncated 2462 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make persistent memory use opt-in rather than requiring it at the start of every task. 2. Obtain explicit user confirmation before storing or changing aliases, workspace IDs, channel IDs, user IDs, or bot identifiers. 3. Treat stored mappings only as hints. Resolve and validate each identifier against the currently authenticated Slack workspace before consequential actions. 4. Display the resolved workspace, bot, channel, and user to the user before sending sensitive information or performing destructive operations. 5. Associate every memory entry with its workspace ID, source, creation time, and last-verification time. 6. Reject ambiguous aliases and require fully qualified references when multiple workspaces or bots are configured. 7. Update individual structured entries atomically instead of instructing the agent to rewrite the complete memory file. 8. Apply restrictive permissions to the memory file and verify that it is not writable by other users. 9. Do not persist instructions, behavioral rules, message content, or values obtained from untrusted Slack messages. ]]>
