CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-106443

CVE-2026-106443: Remote Code Execution in WeasyPrint via Unvalidated Pillow EPS Processing

Amit Schendel
Amit Schendel
Senior Security Researcher

Oct 7, 2026·8 min read·28 visits

Executive Summary (TL;DR)

WeasyPrint prior to 70.0 allows unauthenticated remote code execution via malicious EPS images if Ghostscript is installed on the hosting server.

A critical remote code execution vulnerability was identified in WeasyPrint prior to version 70.0. When compiling HTML containing a malicious Encapsulated PostScript (EPS) graphic on a host with Ghostscript installed, Pillow invokes Ghostscript to process the image, executing arbitrary PostScript commands.

Vulnerability Overview

WeasyPrint is a widely deployed pythonic document generation library designed to compile structured HTML documents and CSS stylesheets into print-ready PDF files. Web developers frequently integrate this component within backend architectures to dynamically generate user-facing assets such as financial invoices, corporate statements, medical records, and custom resumes. Due to the nature of document compilation, WeasyPrint exposes a significant network attack surface, as it must fetch and render external multi-media assets, including vector and raster images, over the network or from internal directories.

During a comprehensive, NLNet foundation-funded security audit executed by Radically Open Security researcher Stefan Vink, a critical validation flaw was identified in WeasyPrint's image processing component. The vulnerability, tracked as CVE-2026-106443, resides in the way WeasyPrint's fetching module processes external files. Instead of validating incoming media assets against a strict list of safe MIME types, WeasyPrint forwards raw, unvalidated byte arrays directly to Pillow's (PIL) generic file loader, enabling an attacker to dispatch malicious files to hazardous backend parsers.

When WeasyPrint processes an input HTML document containing a malicious Encapsulated PostScript (EPS) file, the Pillow library automatically matches the magic bytes of the file and invokes its internal EPS renderer. If the underlying host environment contains an active installation of Ghostscript, Pillow attempts to rasterize the vector file by spawning an external Ghostscript subprocess. Because PostScript is a Turing-complete language, an attacker who successfully routes execution to this interpreter can run arbitrary operations. If the interpreter has known sandbox escape vulnerabilities, this design flaw results in unauthenticated remote code execution on the hosting infrastructure.

Root Cause Analysis

The root cause of this vulnerability lies in the architecture of the Pillow image parsing library combined with the lack of input sanitization in WeasyPrint's asset fetching pipeline. In standard operations, Pillow relies on an automatic format detection mechanism implemented inside Image.open(). When an application passes a file-like object or a byte stream to this function, Pillow reads the initial bytes of the payload to identify file signatures, matching them against registered image plugin classes. When an EPS or PS file is supplied, Pillow matches the signature and instantiates PIL.EpsImagePlugin without querying the calling application for authorization.

Because Pillow cannot natively render the complex vector mathematics of PostScript files, it relies on an external rendering engine. The EpsImagePlugin class contains logic that automatically identifies the path to the system's Ghostscript binary (gs) and launches it as an external subprocess using Python's subprocess API. The target PostScript code is passed directly to the interpreter as an argument or standard input stream. This creates an implicit, invisible bridge from a seemingly passive image loading function to a command-line interpreter execution path.

PostScript is not merely a markup syntax; it is a full, Turing-complete language capable of file-system interactions, mathematical evaluations, and execution flow controls. Ghostscript uses sandboxing parameters, specifically the -dSAFER execution flag, to restrict file modifications and operating system calls during rasterization. However, Ghostscript is notoriously complex, and security researchers have historically bypassed this sandbox through numerous memory corruption and logical evaluation flaws, such as CVE-2024-29510. Consequently, by passing user-supplied EPS bytes to Pillow, WeasyPrint exposes the underlying server to any active or zero-day Ghostscript sandbox escape vectors present in the environment.

Code-Level Patch Analysis

To understand the exact mechanics of the vulnerability and the subsequent fix, we analyze the implementation within WeasyPrint's core image handling module, located at weasyprint/images.py. Before the patch was applied in version 70.0, WeasyPrint imported standard components from Pillow without overriding default behavior, allowing Pillow to execute system binaries dynamically when an EPS image signature was parsed.

Below is the representation of the vulnerable code path inside weasyprint/images.py contrasted with the applied security patch:

# === VULNERABLE CODE PATH (Pre-v70.0) ===
from PIL import Image, ImageFile, ImageOps
 
# The module initialized generic Pillow parameters but did not restrict
# underlying binary execution configurations.
ImageFile.LOAD_TRUNCATED_IMAGES = True
 
# When an image URI was processed, it was handed straight to Pillow's loader
# which automatically selected EpsImagePlugin if EPS signatures matched:
pillow_image = Image.open(bytestring)
# === PATCHED CODE PATH (v70.0) ===
from PIL import EpsImagePlugin, Image, ImageFile, ImageOps
 
# Don't crash when converting truncated images
ImageFile.LOAD_TRUNCATED_IMAGES = True
 
# [SECURITY FIX] Don't use Ghostscript to render possibly dangerous EPS files.
# By overriding this variable to False, we prevent EpsImagePlugin from
# identifying or executing the external Ghostscript subprocess.
EpsImagePlugin.gs_binary = False

By setting EpsImagePlugin.gs_binary = False globally during module initialization, WeasyPrint completely eliminates the capability of the Pillow library to invoke the external gs command-line utility. If an EPS file is processed, the Pillow library immediately fails to initialize the rendering pipeline and raises an exception. The patch wraps the RasterImage instantiation in a robust exception handling block to prevent these execution failures from crashing the document generation engine, converting the fatal exception into a handled log message instead.

This remediation is highly robust and structurally complete. Since the EpsImagePlugin requires a valid path to gs_binary to generate any subprocess, hardcoding this configuration value to False prevents the subprocess execution path from being reached under any circumstances. It removes the capability entirely, leaving no residual attack paths for variant exploitation of the Ghostscript interpreter via this module.

Exploitation and Attack Methodology

Exploitation of CVE-2026-106443 requires that the target hosting server has Ghostscript installed and that the application leverages a vulnerable version of WeasyPrint to process user-supplied markup. The attack begins with the generation of an Encapsulated PostScript (EPS) file containing malicious instructions. Since PostScript supports administrative file access operations, an attacker can construct an EPS file that reads or writes local configuration files, or executes administrative utilities on the machine, as demonstrated in the following payload structure:

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 100 100
(/tmp/test-marker.txt) (w) file
dup (test_GHOSTSCRIPT_MARKER\n) writestring
closefile
0.5 setgray 0 0 100 100 rectfill
showpage
%%EOF

Once the payload is formulated, the adversary must force WeasyPrint to fetch and process it. This can be achieved through multiple injection vectors within the submitted HTML. The most direct vector is an <img> tag pointing to the malicious resource. If the target application implements network controls to prevent fetching remote resources, the attacker can bypass this restriction entirely by encoding the payload as a base64 string inside an inline data URI directly in the HTML or CSS stylesheet:

<img src="data:image/eps;base64,JVBTLUFkb2JlLTMuMCBFUFNGLTMuMAolJUJvdW5kaW5nQm94OiAwIDAgMTAwIDEwMAooL3RtcC90ZXN0LW1hcmtlci50eHQpICh3KSBmaWxlCmR1cCAodGVzdF9HSE9TVFNDUklQVF9NQVJLRVJcbikgd3JpdGVzdHJpbmcKY2xvc2VmaWxlCjAuNSBzZXRncmF5IDAgMCAxMDAgMTAwIHJlY3RmaWxsCnNob3dwYWdlCiUlRU9GCg==">

When the backend server triggers the PDF compilation process, WeasyPrint extracts the image asset, routes it to Pillow, and invokes the Ghostscript interpreter. If Ghostscript is vulnerable to a sandbox escape (e.g., CVE-2024-29510), the execution limits are ignored, and the commands are executed directly in the context of the running web application server.

Impact and Severity Assessment

The impact of this vulnerability is critical, representing a direct path to unauthenticated remote code execution on affected application servers. The CVSS 3.1 score is evaluated at 8.8 (High Severity), reflecting the critical combination of a low attack complexity and the complete absence of required user interaction. The attack vector is Network (AV:N), meaning the vulnerability can be exploited remotely across public boundaries without requiring local access to the hosting network.

Upon successful exploitation of the Ghostscript interpreter, the security posture of the application is completely compromised. Since the commands are run under the context of the application server user (e.g., www-data or gunicorn), the attacker gains the ability to read sensitive environmental variables, extract database credentials, manipulate local application source files, or pivot to local container endpoints. In multi-tenant environments, this can lead to cross-tenant data exposure and horizontal privilege escalation.

Currently, the EPSS score for this vulnerability remains low (0.00689, representing the 51.27th percentile), as active exploitation has not yet been widely observed in the wild. Additionally, the vulnerability is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. However, because PDF generation engines are commonly exposed to public inputs and often run with elevated privileges in internal networks, the actual risk profile for enterprise deployments is substantial.

Remediation and Defensive Hardening

The primary and most effective remediation path is to upgrade WeasyPrint to version 70.0 or later immediately. This version includes the hardcoded mitigation that disables Pillow's command execution path. In addition to upgrading the Python library, security teams should implement defensive system hardening practices to protect application hosts.

If upgrading WeasyPrint immediately is not possible due to legacy system dependencies, administrators can deploy a programmatic workaround. By modifying the application's entrypoint script (such as wsgi.py, asgi.py, or manage.py) to globally disable Ghostscript parsing inside Pillow prior to initializing any other libraries, you can effectively neutralize the attack surface:

# Programmatic hotfix for legacy WeasyPrint installations
from PIL import EpsImagePlugin
EpsImagePlugin.gs_binary = False

Additionally, host environments should be audited to ensure that Ghostscript is uninstalled if it is not explicitly required for business operations. Containerized workloads (e.g., Docker) should use slim or minimal base images that exclude heavy command-line utilities like Ghostscript. Finally, egress traffic filtering should be enforced on PDF rendering hosts to prevent the application from making unvalidated outbound connections to retrieve malicious EPS files from the public internet.

Official Patches

KozeaFix commit disabling Pillow's GS execution path

Fix Analysis (1)

Technical Appendix

CVSS Score
8.8/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
0.69%
Top 49% most exploited
2,500
via Shodan

Affected Systems

WeasyPrint < 70.0

Affected Versions Detail

Product
Affected Versions
Fixed Version
WeasyPrint
Kozea
< 70.070.0
AttributeDetail
CWE IDCWE-20
Attack VectorNetwork (AV:N/AC:L/PR:L/UI:N)
CVSS Severity Score8.8
EPSS Score0.00689 (51.27th Percentile)
Exploit StatusPoC Available
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-20
Improper Input Validation

The product receives input that is expected to be safe but is processed without validating the structure or content.

Known Exploits & Detection

GitHub Security AdvisoryOfficial advisory containing research analysis and proof of concept.

Vulnerability Timeline

Security fix commit authored
2026-08-09
GitHub Security Advisory GHSA-r543-q48m-4c9j published
2026-10-06
CVE-2026-106443 published to NVD
2026-10-06

References & Sources

  • [1]GitHub Security Advisory GHSA-r543-q48m-4c9j
  • [2]WeasyPrint Fix Commit
  • [3]WeasyPrint Release v70.0
  • [4]NVD CVE-2026-106443 Detail
  • [5]CVE.org Record for CVE-2026-106443
Related Vulnerabilities
CVE-2024-29510

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
1 views•10 min read
•about 2 hours ago•CVE-2026-55649
6.3

CVE-2026-55649: Stored Cross-Site Scripting in GeoNode Document Metadata Abstract Field

CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.

Amit Schendel
Amit Schendel
4 views•9 min read
•about 3 hours ago•GHSA-QX75-2P3R-PWM5
7.7

CVE-2026-55622: Cross-Project Instance Copy Authorization Bypass in Canonical LXD and LXC Incus

CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.

Amit Schendel
Amit Schendel
3 views•11 min read
•about 4 hours ago•GHSA-7MR3-28H5-M5VX
7.7

GHSA-7mr3-28h5-m5vx: Authorization Bypass and Cross-Project Volume Copy in Canonical LXD

An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.

Alon Barad
Alon Barad
3 views•10 min read
•about 5 hours ago•GHSA-47W9-6R3F-938G
9.9

GHSA-47w9-6r3f-938g: Authorization Bypass and Host Root Command Execution in Canonical LXD and Incus

A missing authorization and configuration validation vulnerability in Canonical LXD and LXC Incus allows authenticated users within restricted projects to bypass project security boundaries. By smuggling prohibited low-level configuration directives (such as raw.lxc or raw.qemu) inside instance snapshots or backup archives, an attacker can restore these configurations within a restricted project and execute arbitrary commands with root privileges on the underlying host operating system.

Alon Barad
Alon Barad
4 views•11 min read
•about 6 hours ago•GHSA-JPF8-86F3-WP38
9.9

CVE-2026-48752: Arbitrary Host File Read and Write via Templates Symlink in Canonical LXD and Incus

A symbolic link traversal vulnerability (CWE-59) in Canonical LXD and Linux Containers Incus allows an authenticated user with image import permissions to read and write arbitrary files on the host filesystem. During image archive unpacking, the daemon fails to reject top-level symbolic links for the instance `templates` directory. Subsequent requests to the instance template API endpoints follow this symbolic link outside the instance storage directory with root privileges, enabling complete host compromise.

Amit Schendel
Amit Schendel
4 views•10 min read