En resumen
- CVE-2026-49452 es una vulnerabilidad MEDIO (CVSS 6.5) que afecta a weasyprint.
- Probabilidad de explotación en los próximos 30 días (EPSS): 0.37%, mayor que el 31.4% de las vulnerabilidades.
- Aún no hay una versión corregida: sigue el aviso del fabricante en Referencias.
| Package | Affected versions | Patched versions |
|---|
| weasyprint PyPI | ≤ 68.1
| No fix yet |
Description
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
- CSS injection
- Server-side requests via injected
url()
- Limited to cases where
presentational_hints=True
Suggested Fix
NVD 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.
Running one of these products? Scan your site to see whether it exposes a vulnerable version.
Scan my site free