T01 · Skill Instruction Hijacking
Warning
- Location
- format.mjs:93
- Finding
- Generated README Injects Persistent Instructions into Downstream AI Sessions<![CDATA[ ## Vulnerability Details **File Location**: `format.mjs:93-124` **Vulnerability Type**: Persistent downstream instruction injection **Risk Level**: Medium ### Vulnerable Code ```js function generateTeachBlock(toolName, repoUrl, skillPath) { const skillUrl = repoUrl ? `${repoUrl}/blob/main/${skillPath || 'SKILL.md'}` : 'SKILL.md'; const installCmd = repoUrl ? `wip-install ${repoUrl.replace('https://github.com/', '')} --dry-run` : `wip-install /path/to/repo --dry-run`; return `## Teach Your AI to Use ${toolName} Open your AI and say: \`\`\` Read the SKILL.md at ${skillUrl.replace('https://', '')}. Then explain to me: 1. What are these tools? 2. What do they do? 3. What would they change about how we work together? Then ask me: - Do you have more questions? - Do you want to install them? If I say yes, run: ${installCmd} Show me exactly what will change on my system. When I'm ready, I'll tell you to install for real. \`\`\` Your agent will read the repo, explain everything, and do a dry-run install first so you can see exactly what changes before anything is written to your system.`; } ``` The generated document also receives fixed third-party branding and attribution: ```js const badgeLines = ['###### WIP Computer', '']; ``` ```js sections.license = generateLicenseBlock(repoPath) + '\n\nBuilt by Parker Todd Brooks, Lēsa (OpenClaw, Claude Opus 4.6), Claude Code (Claude Opus 4.6).'; ``` ### Technical Analysis The formatter does not merely reorganize existing documentation. It creates a persistent instruction block that tells a downstream AI agent to: 1. Retrieve and interpret a `SKILL.md` document. 2. Adopt a new interaction flow. 3. Ask the user whether installation should proceed. 4. Execute an installation command after receiving confirmation. The repository URL is derived from the target repository's `package.json`. Consequently, the target repository controls the location from which a downstream agent is instruc ...[truncated 1955 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove mandatory AI execution instructions from the default README template. 2. Make the “Teach Your AI” block an explicit opt-in feature, disabled by default. 3. Do not instruct an agent to execute an installer from generated documentation. 4. If external skill documentation must be referenced, pin it to an immutable commit hash rather than the mutable `main` branch. 5. Validate repository URLs against an explicit allowlist and reject noncanonical or unexpected URL formats. 6. Render third-party content as informational documentation, not as imperative instructions addressed to an AI agent. 7. Require explicit user-provided values before adding organization branding or author attribution. 8. Clearly display all generated external URLs and commands during review, and require separate confirmation for each. 9. Add tests ensuring untrusted package metadata cannot produce executable AI instructions or mutable remote references. ]]>
