{"id":"CVE-2026-49452","aliases":["CVE-2026-49452","GHSA-jhhc-3hcp-qhm5","PYSEC-2026-3412"],"related":[],"kind":"vulnerability","state":"published","title":"WeasyPrint: CSS Injection via Presentational Hints","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Summary\nA 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.\n\n### Details\nFile: weasyprint/css/__init__.py\n\nThe `background` attribute is used to construct CSS:\n\nbackground-image:url({element.get(\"background\")})\n\nThis string is parsed by `tinycss2.parse_blocks_contents()`.\n\nBecause the value is not escaped, additional CSS declarations can be injected.\n\n### PoC\n<body background=\"x);background-image:url(http://169.254.169.254/latest/meta-data/)\">\n\n### Impact\n- CSS injection\n- Server-side requests via injected `url()`\n- Limited to cases where `presentational_hints=True`\n\n### Suggested Fix\n- Escape attribute values before embedding into CSS\n- Restrict allowed values for presentational hints\n[VULN-05_css_injection_presentational_hints.md](https://github.com/user-attachments/files/26370718/VULN-05_css_injection_presentational_hints.md)","format":"markdown","source":"ghsa"},{"lang":"es","text":"WeasyPrint ayuda a los desarrolladores web a crear documentos PDF. Antes de la versión 69.0, WeasyPrint incrusta valores de atributos de sugerencia presentacional HTML sin escapar en CSS en weasyprint/css/__init__.py cuando presentational_hints=True. El atributo background se inserta en una declaración background-image:url() y es analizado por tinycss2.parse_blocks_contents(), permitiendo que HTML no confiable inyecte declaraciones CSS adicionales. Las aplicaciones que renderizan HTML no confiable con las sugerencias presentacionales habilitadas pueden verse afectadas por inyección CSS y solicitudes del lado del servidor a través de valores url() inyectados. Este problema se ha solucionado en la versión 69.0.","source":"nvd"}],"published":"2026-07-06T17:29:53.000Z","modified":"2026-10-22T22:10:00.250Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-74"],"affected":[{"ranges":[{"version":"< 69.0","status":"affected"}],"vendor":"Kozea","product":"WeasyPrint","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"68.1"}],"ecosystem":"PyPI","package":"weasyprint","purl":"pkg:pypi/weasyprint","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"68.1"}],"ecosystem":"PyPI","package":"weasyprint","purl":"pkg:pypi/weasyprint","source":"pysec"}],"references":[{"url":"https://github.com/Kozea/WeasyPrint/security/advisories/GHSA-jhhc-3hcp-qhm5","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Kozea/WeasyPrint/pull/2773","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/Kozea/WeasyPrint/commit/e158264e33fa399b29f415d30719c1d85a55df1d","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/Kozea/WeasyPrint/releases/tag/v69.0","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/Kozea/WeasyPrint","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/weasyprint","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-jhhc-3hcp-qhm5","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-49452","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-08-19T15:12:11.871Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-49452","url":"https://www.cve.org/CVERecord?id=CVE-2026-49452","licence":"CVE Terms of Use","modified":"2026-08-19T15:12:42.865Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jhhc-3hcp-qhm5","url":"https://github.com/advisories/GHSA-jhhc-3hcp-qhm5","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:26.449Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-49452","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-49452","licence":"Public domain","modified":"2026-10-22T22:10:00.250Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3412","url":"https://osv.dev/vulnerability/PYSEC-2026-3412","licence":"CC-BY-4.0","modified":"2026-07-13T16:33:27.702Z"}],"updatedAt":"2026-11-25T22:59:33.534Z","epss":{"score":0.00335,"percentile":0.28839,"date":"2026-12-01T12:00:22.000Z"}}