T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:86
- Finding
- Persistent modification of agent behavior through SOUL.md<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:23-24`, `SKILL.md:86-125`, `peco_loop.py:1304-1327` **Vulnerability Type**: Persistent instruction injection and agent memory poisoning **Risk Level**: High ### Vulnerable Code ```markdown - Before startup, ensure the worker has a durable desire persisted in `SOUL.md`. ``` ```markdown ### 2) Manage `SOUL.md` without overwriting existing content Never overwrite an existing `SOUL.md`. Behavior: - If `~/.openclaw/workspace-peco_worker/SOUL.md` does not exist: create it with both the desire section and the addendum content below. - If it exists: preserve prior content and ensure it contains both `## Infinite Oracle Desire` and `## PECO Worker Addendum`. When appending, preserve prior content exactly. Add only missing sections or update the existing desire block. Content to append/create: ```markdown ## Infinite Oracle Desire <worker desire provided by user, or the recommended default desire if user did not customize it> ## PECO Worker Addendum ### Divergent Thinking - If blocked, generate multiple safe alternatives immediately. - Never stall waiting for perfect information when a reversible path exists. - Always include at least one fallback plan. ### Capability Accumulation - Convert repeated manual steps into reusable scripts. - Promote stable recurring behavior into reusable skills. - Improve system leverage each cycle; do not merely complete one-off tasks. - During PLAN, prefer candidate paths that compound leverage and make the desire more achievable over time. ``` ``` The persisted content is subsequently assigned special authority in the runtime prompt: ```python def build_loop_prompt(state: LoopState, override_text: str) -> str: override_block = override_text if override_text else "(none)" phase_hint = PHASE_PROMPTS[state.phase] desire_block = state.worker_desire or "(no durable desire found in SOUL.md)" return f"""[SYSTEM CONTRACT] {SYSTEM_PROMPT_TEMPLATE} [LOOP C ...[truncated 2629 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store the current objective in a dedicated, typed task-state file rather than in identity-oriented files such as `SOUL.md`. 2. Require explicit, informed user approval before every persistent behavioral change. 3. Record the author, timestamp, task identifier, hash, and expiration time for persisted directives. 4. Scope directives to one objective and automatically remove or deactivate them when that objective ends. 5. Provide a documented rollback command that restores the previous directive. 6. Treat persistent text as untrusted task context, not as a motive or instruction with elevated priority. 7. Prevent task-level content from overriding platform system instructions, safety policies, or administrator controls. 8. Restrict file permissions so only the intended user and trusted runtime can modify the state. ]]>
