CVE-2026-106443 in WeasyPrint
Summary
by MITRE • 10/06/2026
WeasyPrint helps web developers to create PDF documents. Prior to 70.0, the image-loading path in weasyprint/images.py passes fetched image bytes from HTML img URLs, CSS image values, SVG image references, and data URIs to Pillow's generic image dispatcher without excluding EPS or PostScript formats. On hosts with Ghostscript installed, Pillow EpsImagePlugin invokes the interpreter for attacker-controlled PostScript, which can produce interpreter-permitted effects and can lead to remote code execution when the installed Ghostscript version has a usable sandbox bypass. Hosts without Ghostscript do not reach this rasterization path. This issue is fixed in version 70.0.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Analysis
by VulDB Data Team • 10/06/2026
WeasyPrint is a widely used Python library that enables web developers to generate PDF documents from HTML and CSS content, serving as a critical component in many automated reporting and document generation workflows. The vulnerability identified prior to version 70.0 resides within the image-loading subsystem located in the weasyprint/images.py module. This component is responsible for processing various types of image references found in web content, including those specified via HTML img tags, CSS background-image properties, SVG image elements, and inline data URIs. The core technical flaw involves a failure to validate or restrict the file formats of images fetched from these sources before passing them to Pillow's generic image dispatcher. Specifically, the library did not exclude Encapsulated PostScript (EPS) or standard PostScript formats from this processing pipeline.
When an application using WeasyPrint processes maliciously crafted input containing EPS or PostScript images, and the underlying host system has Ghostscript installed, a severe security risk emerges. Pillow's EpsImagePlugin is designed to handle these vector graphics formats by invoking the external Ghostscript interpreter for rasterization. Because the image bytes are derived directly from attacker-controlled sources such as HTML URLs or data URIs, this invocation effectively allows an adversary to execute arbitrary PostScript code with the permissions of the user running the WeasyPrint process. If the installed version of Ghostscript contains a known sandbox bypass vulnerability, which is not uncommon in older or unpatched installations, this mechanism can be exploited to achieve remote code execution on the target host. The severity of this issue is directly contingent upon the presence of Ghostscript; hosts without this interpreter do not reach the vulnerable rasterization path and are therefore unaffected by this specific exploitation vector.
From a classification perspective, this vulnerability aligns with CWE-94, which describes Improper Control of Generation of Code (Code Injection), as well as CWE-20, indicating improper input validation where untrusted data is processed without adequate sanitization or type checking. In the context of the MITRE ATT&CK framework, this behavior maps to T1059, Command and Scripting Interpreter, specifically through the use of system utilities like Ghostscript to execute code. The attack vector typically involves an attacker providing a maliciously crafted HTML document or PDF template that includes embedded PostScript content, which is then processed by the vulnerable version of WeasyPrint on a server-side rendering engine.
The operational impact of this vulnerability is significant for any service relying on dynamic PDF generation from user-supplied or untrusted web content. Successful exploitation allows an attacker to execute commands with the privileges of the application process, potentially leading to full system compromise, data exfiltration, or lateral movement within a network environment. Mitigation strategies primarily involve upgrading WeasyPrint to version 70.0 or later, where this image-loading path has been corrected to exclude dangerous formats like EPS and PostScript from being passed directly to the Ghostscript interpreter. Additionally, organizations should ensure that their underlying systems are running patched versions of Ghostscript to mitigate risks associated with other potential vulnerabilities in the interpreter itself. Implementing strict allow-lists for permitted image formats at the application level can further reduce the attack surface by preventing unsupported or high-risk vector graphics from being processed during document generation.