T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/render.py:13
- Finding
- Chromium Sandbox Disabled While Rendering Untrusted HTML## Vulnerability Details **File Location**: `scripts/render.py:13` **Vulnerability Type**: Browser sandbox disabled for attacker-controlled active content **Risk Level**: High **Vulnerable Code**: ```python browser = p.chromium.launch(args=['--no-sandbox']) ``` ### Technical Analysis The renderer accepts the contents of a user-selected HTML file and loads them into Chromium using `page.set_content()`. The HTML may contain JavaScript and references to remote resources. Chromium is launched with `--no-sandbox`, which disables an important operating-system-level security boundary intended to contain compromised browser processes. Web-origin controls may still restrict ordinary page behavior, but they are not a replacement for Chromium's process sandbox. If malicious HTML exploits a vulnerability in Chromium or one of its rendering components, disabling the sandbox allows the resulting code to execute directly with the privileges of the account running `render.py`. ### Attack Path 1. An attacker creates or modifies an HTML input file containing malicious active content. 2. The victim invokes `render.py` with that file as its input. 3. The script starts Chromium with `--no-sandbox`. 4. Chromium parses the content, executes JavaScript, and loads any referenced remote resources. 5. Malicious content exploits a compatible Chromium or rendering-engine vulnerability. 6. Because the process sandbox is disabled, successful exploit code runs with the renderer user's host permissions rather than being confined by the normal Chromium sandbox. Exploitation beyond normal browser behavior requires a suitable browser vulnerability, but the configuration materially increases the impact of such a vulnerability. ### Impact Assessment A successful exploit could obtain the privileges of the operating-system user running the renderer. Depending on that account's permissions, this could permit access to readable files, modification of writ ...[truncated 278 chars]
- Remediation
- ## Remediation Suggestions - Remove the `--no-sandbox` argument and run Chromium with its standard sandbox enabled: ```python browser = p.chromium.launch() ``` - Ensure the host supports Chromium sandboxing and run the renderer as a dedicated, unprivileged user. - If sandboxing cannot be enabled, perform rendering inside a disposable, hardened container or virtual machine with: - No host filesystem mounts except narrowly scoped input and output locations. - A read-only root filesystem. - Dropped Linux capabilities. - No privilege escalation. - CPU, memory, process, and execution-time limits. - Restricted or disabled outbound network access. - Treat all input HTML as untrusted. Disable JavaScript when it is not required and intercept network requests to allow only explicitly approved font or asset origins. - Keep Playwright and its corresponding Chromium build patched through a controlled update process.
