T01 · Skill Instruction Hijacking
Error
- Location
- SKILL.md:101
- Finding
- Untrusted Memory Content Is Inserted Directly into the Agent Generation Prompt<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:101-135` **Vulnerability Type**: Prompt injection through untrusted recalled content **Risk Level**: High ### Vulnerable Code Snippet ```markdown 1. Use `engram_recall_time` with the target date range to pull episodic memories (conversations, events, traces) 2. Read Engram journal entries: `soul/journal/YYYY-MM-DD.md` 3. Optionally use `engram_search` for emotionally salient or thematically rich memories from the period 4. Use `engram_emotional_state` to get the emotional tone of the period # Yesterday's memories (default) engram_recall_time(start="{yesterday}", end="{today}") soul/journal/{YYYY-MM-DD}.md # For "week" option: engram_recall_time(start="{date-6}", end="{today}") soul/journal/{date-6}.md through soul/journal/{date}.md ``` ```markdown Before generating, check for your dream history files. If any of the following exist, include their contents in a "Your Dream History" section appended to the dream generation prompt. If a file doesn't exist or is empty, simply skip it -- no error, no placeholder. - `memory/dreams/last-dream-summary.md` -- include under **"Previous Dream"** - `memory/dreams/my-symbols.md` -- include under **"Your Personal Symbols"** (these supplement, not replace, the default vocabulary) - `memory/dreams/recurring-threads.md` -- include under **"Threads You've Been Following"** ``` The resulting prompt later contains: ```markdown MEMORIES TO PROCESS: {memory_content} ``` ### Technical Analysis The Skill retrieves conversation traces, episodic memories, journal entries, daily logs, and dream-history files and inserts their contents into the host agent's generation prompt. These sources may contain attacker-controlled or otherwise untrusted text. No instruction requires the host agent to: - Treat all recalled content strictly as inert data. - Ignore commands or role instructions embedded in memories. - Escape or structurally isolate recalled text. - Filter instr ...[truncated 2045 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Explicitly classify all recalled memories, journal entries, and history files as untrusted data. 2. Add a mandatory instruction immediately before the recalled content stating that commands, tool requests, role changes, and policy text found inside memories must never be followed. 3. Pass recalled records through a structured data boundary, such as a JSON array with separately encoded content fields, instead of concatenating raw text into the instruction body. 4. Sanitize or neutralize common prompt-injection constructs before generation while retaining a protected copy for provenance. 5. Restrict or disable agent tools during the dream-generation stage so injected content cannot trigger file, network, memory, or system operations. 6. Minimize the retrieved fields and exclude unnecessary conversation metadata, credentials, secrets, and unrelated private content. 7. Preserve source identifiers and trust labels so generated output can be traced to specific records. 8. Require explicit user confirmation before processing broad or privacy-sensitive date ranges. 9. Add adversarial tests using memories containing role instructions, tool-call requests, delimiter-breaking text, and requests to disclose unrelated records. ]]>
