T09 · Insecure Skill Coding Practices
- Location
scripts/search.mjs:66- Finding
Untrusted Search Results Rendered for Direct AI Agent Ingestion
- Content
View full analysis
{ console.log(`### ${index + 1}. [${res.title}](${res.url})`); console.log(`**Source:** ${res.source} | **Date:** ${res.date}`); console.log(`${res.snippet}\n`); }); ``` ### Technical Analysis The `title`, `url`, `source`, `date`, and `snippet` fields originate from an external search API and are inserted directly into Markdown without sanitization, escaping, URL validation, or trust-boundary markers. The skill documentation states that this output is suitable for direct ingestion by AI agents. Consequently, attacker-controlled search content can enter an agent's context as natural-language instructions or crafted Markdown. An attacker may publish content designed to rank for a targeted query, or a compromised upstream API may return malicious fields. Possible payloads include: - Instruction-like text intended to override the consuming agent's current task. - Markdown that disguises an attacker-controlled URL as a trusted destination. - Crafted titles or snippets that alter the apparent structure of the returned document. - Non-HTTP URL schemes or misleading links if a downstream renderer makes them actionable. The script does not itself execute the returned content. Exploitation therefore depends on a downstream AI agent or renderer treating the generated Markdown as trusted instructions or actionable content. ### Attack Path 1. An attacker publishes a page containing prompt-injection text or crafted Markdown and causes it to be indexed by the upstream search provider. Alternatively, the upstream API or its response path is compromised. 2. A user or agent invokes the skill with a query for which the malicious page is returned. 3. The external API places attacker-controlled values in ...[truncated 1141 chars]- Remediation
View remediation
