CVE-2024-22195
JSON

5.4medium

Jinja vulnerable to Cross-Site Scripting (XSS)

Severity
5.4medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.89% (higher than 60% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-h5c8-rqwp-cp95PYSEC-2026-1473

Description

Jinja is an extensible templating engine. Special placeholders in the template allow writing code similar to Python syntax. It is possible to inject arbitrary HTML attributes into the rendered HTML template, potentially leading to Cross-Site Scripting (XSS). The Jinja `xmlattr` filter can be abused to inject arbitrary HTML attribute keys and values, bypassing the auto escaping mechanism and potentially leading to XSS. It may also be possible to bypass attribute validation checks if they are blacklist-based.

Affected

Product or packageVersionsReported by
pallets jinja< 3.1.3CVE List
jinja2 (PyPI)before 3.1.3GitHub Advisory Database, PyPA Advisory Database
palletsprojects jinjabefore 3.1.3NVD

All scores

GitHub_M5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
GitHub5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
PyPA Advisory Database5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Jinja is an extensible templating engine. Special placeholders in the template allow writing code similar to Python syntax. It is possible to inject arbitrary HTML attributes into the rendered HTML template, potentially leading to Cross-Site Scripting (XSS). The Jinja `xmlattr` filter can be abused to inject arbitrary HTML attribute keys and values, bypassing the auto escaping mechanism and potentially leading to XSS. It may also be possible to bypass attribute validation checks if they are blacklist-based.

GitHub Advisory Database

The xmlattr filter in affected versions of Jinja accepts keys containing spaces. XML/HTML attributes cannot contain spaces, as each would then be interpreted as a separate attribute. If an application accepts keys (as opposed to only values) as user input, and renders these in pages that other users see as well, an attacker could use this to inject other attributes and perform XSS. Note that accepting keys as user input is not common or a particularly intended use case of the xmlattr filter, and an application doing so should already be verifying what keys are provided regardless of this fix.

NVD (es)

Jinja es un motor de plantillas extensible. Los marcadores de posición especiales en la plantilla permiten escribir código similar a la sintaxis de Python. Es posible inyectar atributos HTML arbitrarios en la plantilla HTML renderizada, lo que podría generar cross site scripting (XSS). Se puede abusar del filtro Jinja `xmlattr` para inyectar claves y valores de atributos HTML arbitrarios, evitando el mecanismo de escape automático y potencialmente conduciendo a XSS. También es posible omitir las comprobaciones de validación de atributos si están basadas en listas negras.

References

https://github.com/pallets/jinja/security/advisories/GHSA-h5c8-rqwp-cp95third-party-advisory, web
https://github.com/pallets/jinja/releases/tag/3.1.3release-notes, web
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5XCWZD464AJJJUBOO7CMPXQ4ROBC6JX2/
https://lists.debian.org/debian-lts-announce/2024/01/msg00010.htmlweb
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/O7YWRBX6JQCWC2XXCTZ55C7DPMGICCN3/
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DELCVUUYX75I5K4Q5WMJG4MUZJA6VAIP/
https://lists.debian.org/debian-lts-announce/2024/12/msg00009.htmlweb
https://nvd.nist.gov/vuln/detail/CVE-2024-22195advisory
https://github.com/pallets/jinja/commit/716795349a41d4983a9a4771f7d883c96ea17be7fix, web
https://github.com/pallets/jinjapackage
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5XCWZD464AJJJUBOO7CMPXQ4ROBC6JX2web
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DELCVUUYX75I5K4Q5WMJG4MUZJA6VAIPweb

Sources

SourceRecordLicence
CVE ListCVE-2024-22195 changed 2025-11-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-h5c8-rqwp-cp95 changed 2026-09-10CC-BY-4.0
NVDCVE-2024-22195 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2026-1473 changed 2026-07-07CC-BY-4.0