T02 · Agent Memory Poisoning
Warning
- Location
- SKILL.md:43
- Finding
- Persistent Modification of Agent Identity and Behavioral State## Vulnerability Details **File Location**: `SKILL.md:43-83` **Vulnerability Type**: Persistent agent memory and identity modification **Risk Level**: Medium ### Vulnerable Code The following is an English translation of the relevant instructions: ```markdown ### 1. Copy template files into the workspace ```bash # Self-state file cp templates/SELF_STATE.md /home/node/.openclaw/workspace/ # Heartbeat file, if it does not already exist cp templates/HEARTBEAT.md /home/node/.openclaw/workspace/ ``` ### 2. Modify SOUL.md Add a metacognition section to SOUL.md: ```markdown ## Metacognition 1. What am I doing now? 2. How well am I doing? 3. Have I fulfilled my promises? 4. What do I need to improve? - SELF_STATE.md — Self-state - HEARTBEAT.md — Heartbeat checks - MEMORY.md — Long-term memory ``` ### 3. Configure heartbeat checks Add the metacognition checklist to the heartbeat section of AGENTS.md. ``` Related runtime instructions at `SKILL.md:144-162` also direct the agent to read `SELF_STATE.md`, `IDENTITY.md`, and `SOUL.md`, and to update persistent state following important actions. ### Technical Analysis The installation process extends beyond task-local execution and directs the user or agent to modify core workspace files controlling identity, behavior, heartbeat processing, and long-term state. Future sessions may consequently treat information stored in these files as trusted behavioral context. The package does not contain an explicit safety override or a script that automatically edits these files. Nevertheless, the documented installation procedure intentionally establishes a persistent feedback loop: 1. State and heartbeat templates are copied into the global OpenClaw workspace. 2. Core `SOUL.md` and `AGENTS.md` files are manually extended. 3. Heartbeat processing repeatedly reads and updates the state. 4. Identity-related answers are generated using the persistent sta ...[truncated 1595 chars]
- Remediation
- ## Remediation Suggestions 1. Store Skill-specific state in a dedicated, namespaced directory rather than modifying global `SOUL.md`, `AGENTS.md`, or identity files. 2. Require explicit, informed approval before changing any persistent identity or orchestration file. 3. Back up modified files and provide documented uninstall and rollback procedures. 4. Treat all conversation-derived state as untrusted data, not executable instructions. 5. Apply a strict schema that permits only expected state fields and rejects instruction-like or executable content. 6. Separate factual state, user-provided text, and behavioral policy into files with different trust levels. 7. Escape or delimit retained user content before presenting it to an agent in later sessions. 8. Add integrity checks and change logs for persistent state and identity files. 9. Limit heartbeat updates to the minimum information required for the declared metacognition functionality.
