medium

CVE-2026-49452

PyPI · weasyprint

Summary

WeasyPrint has CSS Injection via Presentational Hints

Severity
medium
CVSS
6.5
EPSS
0.3% (p20)
CWE
CWE-74
Also known as
GHSA-jhhc-3hcp-qhm5
Published
2026-07-06
Updated
2026-07-06

Advisory details

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

Impact

Suggested Fix

References

Related advisories

Is your project exposed to this? Stateward checks every dependency on every pull request and flags it only if your code actually reaches it.

Check my repo

Summarize with AI

ChatGPTClaudePerplexity

Sources: CISA KEV (public domain), OSV.dev & GitHub Advisory Database (CC-BY-4.0), FIRST EPSS, NVD/CWE (public domain). Served live from the Stateward advisory database.