T09 · Insecure Skill Coding Practices
- Location
assets/lib/converter.js:8- Finding
Active HTML Injection in Markdown Preview
- Content
View full analysis
' + html + ''; ``` ### Technical Analysis The Markdown parser explicitly enables raw HTML with `html: true`. The resulting HTML is subsequently assigned to `innerHTML` without an HTML sanitizer or restrictive Content Security Policy. Although script elements inserted through `innerHTML` are not consistently executed by browsers, active HTML constructs such as event-handler attributes can execute JavaScript. For example, attacker-controlled Markdown can contain an image with an invalid source and an `onerror` handler. Since the preview is served from the same origin as the local API, injected code can issue fully privileged same-origin requests. This behavior is not required for basic Markdown preview functionality. Raw HTML should either be disabled or sanitized. ### Attack Path 1. An attacker supplies or modifies a Markdown file. 2. The victim opens the file using the preview Skill. 3. `markdown-it` preserves attacker-controlled raw HTML because `html: true` is enabled. 4. The page inserts that HTML into the DOM using `innerHTML`. 5. An activ ...[truncated 991 chars]- Remediation
View remediation
