weasyprint
Affected
- introduced
0, last affected68.1(ecosystem)
Fixed versions
None listed
Fix
No fixed version is listed.
Advisory
Also known as: CVE-2026-49452, GHSA-jhhc-3hcp-qhm5
WeasyPrint has CSS Injection via Presentational Hints
Summary
A CSS injection issue exists in WeasyPrint when HTML presentational hints are enabled. Unescaped attribute values are embedded into CSS, allowing injection of arbitrary CSS declarations. This affects applications processing untrusted HTML input.
Details
File: weasyprint/css/__init__.py
The background attribute is used to construct CSS:
background-image:url({element.get("background")})
This string is parsed by tinycss2.parse_blocks_contents().
Because the value is not escaped, additional CSS declarations can be injected.
PoC
<body background="x);background-image:url(http://169.254.169.254/latest/meta-data/)">
Impact
url()presentational_hints=TrueSuggested Fix
Medium Basis: CVSS v3 score 6.5, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
0, last affected 68.1 (ecosystem)None listed
No fixed version is listed.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: PyPA Advisory Database · CC BY 4.0