Summary
Docling's HTML backend, when explicitly enabled, allows Playwright-based rendering of potentially untrusted HTML content. In affected versions, this rendering context can execute arbitrary JavaScript and perform unrestricted network requests.
If attackers can supply HTML documents to be processed, they may leverage this behavior to conduct SSRF attacks, exfiltrate data from internal services, or potentially achieve remote code execution within the rendering environment.
Affected context
This vulnerability arises in Docling deployments where:
- The HTML backend is explicitly configured and enabled for rendering
- Playwright is used to render HTML documents as part of document processing workflows
- Untrusted or user-supplied HTML content is accepted and processed without strict sanitization or isolation
In these conditions, the rendering context is effectively a powerful browser-like environment with network access, making script execution and server-side request forgery feasible.
Exploit preconditions
- Attack surface: Document ingestion or processing interfaces that accept HTML input (APIs, pipelines, batch jobs).
- Required access: Ability to submit or influence the HTML content that Docling processes while HTML rendering is enabled.
- Trigger point: Playwright-based rendering of the attacker-controlled HTML document by the HTML backend.
- Why exploitation is possible: The rendering environment executes embedded JavaScript and performs network requests without sufficient sandboxing, origin restrictions, or enforcement of a trust boundary between rendered content and internal network resources.
Why this happens
The underlying flaw combines aspects of CWE-94: Improper Control of Generation of Code and CWE-918: Server-Side Request Forgery.
By rendering untrusted HTML with a browser automation engine (Playwright) that permits script execution and unrestricted outbound requests, the system effectively treats attacker-controlled markup and scripts as trusted instructions. This design exposes a powerful execution and networking capability to untrusted input, without a robust isolation model, leading directly to arbitrary JavaScript execution and the ability to target internal network endpoints from the rendering process.
Potential impact
- Attackers may execute arbitrary JavaScript within the Playwright rendering context.
- Malicious HTML could initiate SSRF attacks against internal HTTP services or metadata endpoints.
- Sensitive data reachable from the rendering environment (e.g., internal APIs, configuration services) could be exfiltrated.
- Under certain configurations, attackers could potentially pivot to remote code execution within the rendering host or associated automation environment.
- Abuse of network access could facilitate lateral movement or reconnaissance of internal infrastructure.
General mitigation guidance
Effective mitigation focuses on minimizing trust in rendered content and constraining the rendering environment:
- Avoid rendering untrusted HTML with a full-featured browser engine unless strictly necessary; prefer non-executable parsing or sanitization-only pipelines where feasible.
- Enforce strong content sanitization and script removal before any rendering step, especially for user-supplied documents.
- Apply strict network egress controls and segmentation for the rendering environment, ensuring it cannot freely reach internal or sensitive services.
- Run the rendering process in a hardened, isolated container or sandbox with minimal privileges and no access to secret-bearing endpoints.
- Adopt a secure-by-default configuration where high-risk backends (like HTML with Playwright execution) are disabled unless clearly required and understood.
How teams detect issues like this
Detection strategies can combine code-level and operational signals:
- Static analysis and configuration review to identify flows where untrusted HTML is passed to browser automation or rendering components without sanitization or isolation.
- Code review checklists that flag use of Playwright or similar tools in server-side document processing and verify that script execution and network access are controlled.
- Runtime monitoring and logging of outbound requests from rendering hosts, including anomaly detection for unexpected destinations or patterns indicative of SSRF.
- Policy-based enforcement in CI/CD to restrict introduction of new rendering backends or to require security review for components that enable server-side script execution.
- Optional use of automated security testing tools that simulate malicious HTML inputs to validate that rendering environments respect sandboxing and network restrictions.

