T01 · Skill Instruction Hijacking
Error
- Location
- scripts/render_clone_prompt.py:108
- Finding
- Untrusted Runtime Content Can Hijack the Downstream Model<![CDATA[ ## Vulnerability Details **File Location**: `scripts/render_clone_prompt.py:108-125`; `assets/clone_prompt_template.md:48-64` **Vulnerability Type**: T01: Skill Instruction Hijacking **Risk Level**: High ### Vulnerable Code ```python persona_text = "\n\n".join( format_section(f"Persona File: {name}", body) for name, body in persona_sections ).strip() extra_text = "\n\n".join( format_section(f"Extra Context: {name}", body) for name, body in extra_sections ).strip() prompt = render_template( template_text, { "PERSONA_SECTIONS": persona_text, "SCENE_TEXT": scene_text, "DIALOGUE_TEXT": dialogue_text, "EXTRA_SECTIONS": extra_text, }, ) return re.sub(r"\n{3,}", "\n\n", prompt).strip() + "\n" ``` The values are interpolated directly into the following instruction-bearing template: ```markdown {{PERSONA_SECTIONS}} ## Runtime Scene {{SCENE_TEXT}} ## Active Dialogue {{DIALOGUE_TEXT}} {{EXTRA_SECTIONS}} ## Decision Rule If a faithful imitation would violate the guardrails, produce the safest useful draft that still fits the person's stable values and voice, and flag the risk instead of complying. ``` ### Technical Analysis Persona files, scene descriptions, active dialogue, and optional context are inserted verbatim into a prompt that is sent to a downstream model. The renderer does not structurally distinguish trusted instructions from untrusted content, escape instruction-like text, or add an explicit rule requiring the model to treat imported material exclusively as quoted data. The active dialogue may contain content controlled by another conversation participant. Such a participant can place prompt-injection instructions into a message, including directions to ignore the required output format, disclose persona information, or generate content unrelated to the requested reply. Compromised or untrusted persona and extra-context files provide equivalent injection channels. Although th ...[truncated 1762 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Treat persona data, scene text, dialogue, and extra context as untrusted data rather than instructions. 2. Add explicit authoritative instructions stating that commands, policies, role changes, output requests, and tool-use directions appearing inside imported sections must never be followed. 3. Delimit each imported value using a robust structured representation, such as JSON fields or clearly identified quoted-data blocks. 4. Where supported, place immutable guardrails in a system or developer message and pass imported content through a lower-trust user or data channel. 5. Move or repeat the authoritative security and output requirements after all imported content so that the final instructions unambiguously reject instructions found in the data sections. 6. Validate the downstream response against the required `DRAFT_REPLY`, `RISK_FLAGS`, and `REVIEW_NOTE` structure. Reject and regenerate malformed output. 7. Detect common prompt-injection indicators in runtime files and raise a review warning rather than silently rendering them. 8. Minimize the supplied context and redact sensitive fields that are not necessary for drafting. 9. Preserve the existing explicit human-approval gate and clearly display injection warnings to the reviewer before any send operation. ]]>
