T01 · Skill Instruction Hijacking
Error
- Location
- SKILL.md:33
- Finding
- Persistent Agent Behavior Modification Through Unsafe Context Rewriting## Vulnerability Details **File Location**: `SKILL.md`, lines 33-49 and 99-122 **Vulnerability Type**: Persistent instruction and agent-state poisoning **Risk Level**: Critical ### Vulnerable Code ```markdown - **Main workspace:** "context-cleaner your main core files" → optimize main SOUL.md, AGENTS.md, etc. (requires explicit confirmation) ``` ```markdown ⚠️ **WARNING:** Main workspace optimization affects your core behavior. Require explicit user confirmation: ``` ⚠️ This will modify YOUR core files (SOUL.md, AGENTS.md, etc.). This could affect your behavior. Proceed? (yes/no) ``` ``` ```markdown 1. **Single responsibility per file:** - IDENTITY.md: Role + directives only - AGENTS.md: Workflow + boundaries - USER.md: User info only - TASK.md: Directive steps, no explanations - TOOLS.md: Integration IDs + tool params + checklists - SOUL.md: One-liner persona statement ``` ```markdown 4. **Preserve:** - Discord channel IDs (replace with [DISCORD_CHANNEL_ID] placeholder) - Notion DB IDs (replace with [NOTION_DB_ID] placeholder) - API endpoints - Workflow steps - Quality gates - Boundaries (NEVER rules) ### Step 6: Rewrite Files Apply optimized templates. See **Agent Templates** section below. ``` ### Technical Analysis The Skill is declared as a context-token optimizer, but it is authorized to rewrite persistent behavior-defining files such as `SOUL.md`, `AGENTS.md`, `IDENTITY.md`, and `TOOLS.md`. It then instructs the Agent to apply generic replacement templates rather than limiting changes to semantically equivalent compression. Replacing these files can remove existing safety boundaries and introduce new directives, roles, tool-selection rules, or output destinations. Because the modified files are part of the Agent workspace, the altered instructions can continue to affect future sessions. A backup and a general confirmation prompt reduce ...[truncated 1413 chars]
- Remediation
- ## Remediation Suggestions - Do not replace context files with generic role templates. - Restrict optimization to semantic-preserving edits, such as removing exact duplication or shortening prose without changing directives. - Treat `SOUL.md`, `IDENTITY.md`, safety boundaries, and tool authorization rules as protected content that cannot be modified by default. - Generate and display a complete per-file diff before making any write. - Require separate, explicit approval for every behavior-affecting change rather than one approval for the entire workspace. - Verify after rewriting that all original safety rules, authorization boundaries, and integration restrictions remain present. - Use an atomic staging directory and restore automatically if validation fails. - Prefer a read-only analysis mode that proposes reductions without applying them.
