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·32 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 13 hours ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
4 views•10 min read
•about 14 hours ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
5 views•12 min read
•about 15 hours ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
5 views•12 min read
•about 16 hours ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
6 views•10 min read
•about 17 hours ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
12 views•10 min read
•about 18 hours ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
5 views•9 min read