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.
Published: 2026-08-18
Score: 6.5 Medium
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

WeasyPrint, a PDF generation library, persists presentational‑hint attribute values from user‑supplied HTML directly into CSS declarations. The background attribute is inserted into a background‑image:url() property, which the CSS parser then interprets. As a result, an attacker who can supply arbitrary HTML can inject additional CSS rules, and the injected url() values may trigger outbound requests from the server. The vulnerability enables malicious styles to alter rendering and potentially make server‑side requests, which could affect the integrity of the generated PDFs.

Affected Systems

Kozea WeasyPrint library versions prior to 69.0 are vulnerable whenever the presentational hints feature is enabled. Versions 69.0 and newer contain the fix; earlier releases without an explicit upgrade remain exposed.

Risk and Exploitability

The CVSS score of 6.5 indicates moderate severity. No EPSS score is available, and the flaw is not listed in the CISA KEV catalog. Exploitation requires the attacker to provide malicious HTML to the WeasyPrint engine with presentational_hints enabled. Since the attack vector relies on crafted input rather than an external privilege escalation, the risk level is moderate, though the potential for server‑side requests elevates concern for systems processing untrusted content.

Generated by OpenCVE AI on August 18, 2026 at 20:42 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade WeasyPrint to version 69.0 or later where the injection issue is fixed.
  • If an immediate upgrade is not feasible, disable the presentational_hints feature when rendering user‑supplied HTML to prevent the problematic transformation.
  • Implement input sanitization or validation on any HTML that is passed to WeasyPrint to ensure that attribute values do not contain malicious URLs or CSS constructs.

Generated by OpenCVE AI on August 18, 2026 at 20:42 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-jhhc-3hcp-qhm5 WeasyPrint has CSS Injection via Presentational Hints
History

Tue, 18 Aug 2026 19:45:00 +0000

Type Values Removed Values Added
First Time appeared Kozea
Kozea weasyprint
Vendors & Products Kozea
Kozea weasyprint

Tue, 18 Aug 2026 18:15:00 +0000

Type Values Removed Values Added
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.
Title WeasyPrint: CSS Injection via Presentational Hints
Weaknesses CWE-74
References
Metrics cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N'}


Subscriptions

Kozea Weasyprint
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-08-18T17:59:36.144Z

Reserved: 2026-05-30T02:43:33.106Z

Link: CVE-2026-49452

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-08-18T18:17:49.147

Modified: 2026-08-18T18:17:49.147

Link: CVE-2026-49452

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-18T20:45:04Z

Weaknesses
  • CWE-74

    Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')