T09 · Insecure Skill Coding Practices
- Location
scripts/md_to_png.js:458- Finding
Untrusted Markdown Is Rendered as Active HTML in an Unsandboxed Browser
- Content
View full analysis
${html}`, { waitUntil: 'networkidle0' }); ``` ```javascript const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'], headless: true }); const page = await browser.newPage(); await page.setContent(fullHtml, { waitUntil: 'networkidle0' }); ``` ```javascript // Convert to HTML const htmlContent = marked.parse(pageContentWithFooter); // Generate output path let pageOutputPath; ``` ### Technical Analysis The application parses attacker-controllable Markdown through `marked.parse()` and inserts the resulting HTML directly into a live Chromium document. No HTML sanitizer, Content Security Policy, request interception, URL allowlist, JavaScript disabling, or network isolation is applied. Raw HTML supported by the Markdown parser can therefore introduce active elements such as scripts, iframes, event handlers, and remote resources. Ordinary Markdown image syntax can also cause Chromium to request an attacker-selected URL. Because `page.setContent()` waits for network activity, these requests occur both during block-height measurement and final image rendering. This permits blind server-side request forgery against services reachable from the host, including loopback and private-network endpoints. Same-origin restrictions may prevent direct reading of many responses, but they do not prevent outbound requests or state-changing requests to poorly protected internal services. Attacker-controlled browser code can also consume reso ...[truncated 1995 chars]- Remediation
View remediation
