CVE-2026-49452
Received Received - Intake

CSS Injection in WeasyPrint via Unescaped HTML Attributes

Vulnerability report for CVE-2026-49452, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-18

Last updated on: 2026-08-18

Assigner: GitHub, Inc.

Description

WeasyPrint helps web developers to create PDF documents. Prior to 69.0, WeasyPrint embeds unescaped HTML presentational-hint attribute values into CSS in weasyprint/css/__init__.py when presentational_hints=True. The background attribute is inserted into a background-image:url() declaration and parsed by tinycss2.parse_blocks_contents(), allowing untrusted HTML to inject additional CSS declarations. Applications that render untrusted HTML with presentational hints enabled can be affected by CSS injection and server-side requests through injected url() values. This issue is fixed in version 69.0.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-18
Last Modified
2026-08-18
Generated
2026-08-18
AI Q&A
2026-08-18
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
weasyprint weasyprint 69.0

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-74 The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability is a CSS injection issue in WeasyPrint, a Python library for converting HTML to PDF. When HTML presentational hints are enabled, unescaped attribute values are embedded into CSS without proper sanitization. Specifically, the background attribute is used to construct CSS like background-image:url({value}), allowing injection of arbitrary CSS declarations. This affects applications processing untrusted HTML input.

Detection Guidance

To detect this vulnerability, check if your WeasyPrint version is below 69.0. Run: pip show weasyprint or weasyprint --version. If presentational_hints=True is enabled in your application, inspect HTML input for background attributes that may inject CSS. Monitor for unexpected network requests from url() values in CSS.

Impact Analysis

The vulnerability allows attackers to inject malicious CSS into PDF generation, potentially leading to server-side requests via injected url() values. This could enable data exfiltration or further attacks if untrusted HTML is processed with presentational_hints=True enabled.

Mitigation Strategies

Upgrade WeasyPrint to version 69.0 or later. If upgrading is not possible, disable presentational_hints=True in your application. Escape HTML attribute values before embedding them into CSS. Restrict allowed values for presentational hints to prevent CSS injection.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-49452. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart