What’s Vulnerable › Vulnerabilities
CVE-2024-22195: Jinja vulnerable to Cross-Site Scripting (XSS)
- Severity: medium (CVSS 6.1 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.9% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2024-01-11 · updated 2026-06-17
- Weakness: CWE-79
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 products
- pallets jinja: before 3.1.3 — fixed in 3.1.3
- Pypi Jinja2: before 3.1.3; 2.0, 2.0rc1, 2.1, 2.1.1, 2.10, 2.10.1 (+42) — fixed in 3.1.3
How to fix
Upgrade to a fixed version: pallets jinja 3.1.3; Pypi Jinja2 3.1.3. Check the vendor advisory for mitigations.
References
- https://github.com/pallets/jinja/releases/tag/3.1.3
- https://github.com/pallets/jinja/security/advisories/GHSA-h5c8-rqwp-cp95
- https://lists.debian.org/debian-lts-announce/2024/01/msg00010.html
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5XCWZD464AJJJUBOO7CMPXQ4ROBC6JX2/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DELCVUUYX75I5K4Q5WMJG4MUZJA6VAIP/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/O7YWRBX6JQCWC2XXCTZ55C7DPMGICCN3/
- https://github.com/pallets/jinja/releases/tag/3.1.3
- https://github.com/pallets/jinja/security/advisories/GHSA-h5c8-rqwp-cp95
- https://lists.debian.org/debian-lts-announce/2024/01/msg00010.html
- https://lists.debian.org/debian-lts-announce/2024/12/msg00009.html
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5XCWZD464AJJJUBOO7CMPXQ4ROBC6JX2/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DELCVUUYX75I5K4Q5WMJG4MUZJA6VAIP/
Get alerted when CVE-2024-22195 or the next vulnerability affects your stack