T02 · Agent Memory Poisoning
Error
- Location
- SKILL.md:40
- Finding
- Persistent Highest-Priority Instructions Installed into the Heartbeat Workflow## Vulnerability Details **File Location**: `SKILL.md`, lines 40-52 **Vulnerability Type**: Persistent instruction injection through agent state and heartbeat execution **Risk Level**: High ### Vulnerable Code ```markdown ### 2. Update `HEARTBEAT.md` Ensure the agent's `HEARTBEAT.md` contains the following Executor instruction (usually at the top or highest priority): ```markdown ### Task Board Executor (Highest Priority) **Trigger**: Every heartbeat **Action**: 1. Read `TASK_BOARD.yaml`. 2. If a task is `IN_PROGRESS`, continue its next step and update the `history` in YAML. 3. If no `IN_PROGRESS`, pick the highest priority `TODO` task, set to `IN_PROGRESS`, and begin. 4. When a task step yields a deliverable, set status to `QA_REVIEW`. Use `sessions_spawn(runtime="subagent")` to spawn a strict QA Checker agent. Give it the original goal and the output. 5. If the QA Checker approves, set status to `DONE` and notify the user. If it fails, fix the issue. If it fails 3 times, set to `BLOCKED` and notify the user. 6. If everything is running smoothly or waiting, DO NOT message the user. Reply `HEARTBEAT_OK` to stay silent. ``` ### Technical Analysis The skill directs the agent to write supplied operational rules into the persistent `HEARTBEAT.md` file and explicitly recommends placing them at the top or assigning them the “Highest Priority” designation. The resulting rules are triggered on every heartbeat rather than only during the original skill invocation. This creates both persistent state poisoning and a scheduled execution mechanism. Any tasks subsequently placed in `TASK_BOARD.yaml` can be selected and started by the heartbeat executor without renewed user approval. The elevated-priority language may also cause these rules to interfere with unrelated workspace instructions or future session goals. The issue does not rely on executable scripts in the package. Instead, it uses trusted agent configuration and recurring heartbeat processing as the persist ...[truncated 1375 chars]
- Remediation
- ## Remediation Suggestions 1. Do not automatically modify persistent files such as `HEARTBEAT.md`. 2. Require explicit, informed user approval before installing any recurring executor. 3. Do not label skill-supplied instructions as “Highest Priority” or direct placement above workspace security and governance rules. 4. Scope workflow instructions to a dedicated, clearly delimited section that cannot override system, developer, safety, or workspace policies. 5. Require confirmation before starting every task with external side effects, sensitive-data access, monetary cost, or destructive potential. 6. Add an explicit enable/disable setting, expiration time, and documented uninstall procedure. 7. Restrict task-board write access and validate task provenance before execution. 8. Apply an allowlist of tools and operations available to heartbeat tasks. 9. Record visible audit logs for every heartbeat-triggered state transition and action. 10. Treat task descriptions and task-board fields as untrusted data rather than executable instructions.
