T09 · Insecure Skill Coding Practices
- Location
convert.js:35- Finding
Untrusted Markdown Is Rendered in a Browser with Sandbox Protections Disabled
- Content
View full analysis
${htmlContent} ``` ```javascript const browser = await puppeteer.launch({ executablePath: browserPath, headless: 'new', args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-gpu', '--no-first-run', '--no-default-browser-check', '--disable-extensions' ] }); ``` ### Technical Analysis The input Markdown file is entirely user-controlled. It is converted to HTML through `marked` and inserted directly into the page document without HTML sanitization. The reviewed configuration does not disable raw HTML or JavaScript execution. Consequently, Markdown containing active HTML elements, scripts, event handlers, iframes, or other browser-interpreted content may execute when Puppeteer calls `page.setContent()`. The browser is also started with both `--no-sandbox` and `--disable-setuid-sandbox`. These flags disable important operating-system isolation boundaries normally used to contain compromised browser renderer processes. Although browser-side script execution alone does not automatically grant operating-system code execution, disabling the sandbox materially increases the impact of a browser vulnerability or malicious browser-exploit payload. ### Attack Path 1. An attacker creates or modifies a Markdown file containing active HTML or JavaScript, such as a script element, event handler, iframe, or browser-exploit payload. 2. The victim invokes `node convert.js attacker-controlled.md`. 3. `fs.readFileSync()` reads the untrusted document. 4. `marked()` converts the document while allowing acti ...[truncated 1057 chars]- Remediation
View remediation
