T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:304- Finding
Stored HTML and JavaScript Injection in Exported Presentations
- Content
View full analysis
{s.get('title','')}
{s.get('content','')}{s.get('order',0)}""") content = f""" {deck.get('title','Presentation')} ``` ### Technical Analysis The HTML export operation interpolates the deck title, slide title, and slide content directly into an HTML document without context-appropriate escaping or sanitization. These values originate from command-line input and are persisted in `~/.slide/data.jsonl`. Because they are treated as trusted markup during export, an attacker-controlled value can introduce arbitrary HTML elements and event-handler attributes. For example: ```html``` When an exported presentation containing this payload is opened in a browser, the `onerror` handler executes as JavaScript. Escaping only quotation marks would not resolve the issue because the values are inserted into HTML text and title contexts; output encoding or a strict HTML sanitizer is required. ### Attack Path 1. An attacker supplies a malicious deck title, slide title, or slide body to a user or an agent operating the Skill. 2. The value is stored using a command such as: ```bash bash scripts/script.sh add deck_ID \ --title "Quarterly Report" \ --content '
' ``` 3. The user exports the affected deck: ```bash bash scripts/script.sh export deck_ID --format ht ...[truncated 1241 chars]
- Remediation
View remediation
{safe_slide_title}
{safe_slide_content}{s.get('order', 0)}""") ``` 3. If limited formatting is an intended feature, process slide content through a maintained allowlist sanitizer. Permit only necessary formatting tags and attributes, and reject: - `` - `` - `` - SVG event handlers - `javascript:` links - Malformed and nested HTML tags Tests should verify that these values appear as ...[truncated 54 chars]
