CVE-2024-22195
Python vulnerability analysis and mitigation

Overview

Jinja2, a widely used Python templating engine with over 33 million weekly downloads, was found to contain a Cross-Site Scripting (XSS) vulnerability identified as CVE-2024-22195. The vulnerability was discovered in January 2024 and affects all versions prior to 3.1.3. The vulnerability exists in the xmlattr filter functionality, which incorrectly handles HTML attribute keys containing spaces, potentially allowing for arbitrary HTML attribute injection (Snyk Blog, GitHub Advisory).

Technical details

The vulnerability stems from the xmlattr filter's acceptance of keys containing spaces, which violates XML/HTML attribute standards. When user input is passed as attribute keys and rendered in pages visible to other users, attackers could exploit this to inject additional attributes and execute cross-site scripting attacks. The vulnerability has been assigned a CVSS v3.1 base score of 6.1 (Medium) by NVD and 5.4 (Medium) by GitHub, with the vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N (NVD, GitHub Advisory).

Impact

The vulnerability could allow attackers to perform cross-site scripting (XSS) attacks by injecting malicious HTML attributes into templates. This could lead to the execution of unauthorized JavaScript code in users' browsers, potentially compromising user data and session information. The impact is particularly significant for applications that accept user input as attribute keys in the xmlattr filter (GitHub Advisory).

Mitigation and workarounds

The vulnerability has been fixed in Jinja2 version 3.1.3. Users are strongly advised to upgrade to this version immediately. For those unable to upgrade immediately, it's recommended to implement strict validation of attribute keys if accepting user input, particularly ensuring no spaces are present in attribute keys. Organizations should also verify that their attribute validation checks are not solely based on blacklists (GitHub Release, Debian Advisory).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-22871HIGH8.7
  • PythonPython
  • guarddog
NoYesJan 13, 2026
GHSA-58pv-8j8x-9vj2HIGH8.6
  • PythonPython
  • jaraco.context
NoYesJan 13, 2026
CVE-2026-22779MEDIUM6.3
  • PythonPython
  • blacksheep
NoYesJan 14, 2026
CVE-2026-21889LOW2.3
  • PythonPython
  • weblate
NoYesJan 14, 2026
CVE-2025-68492LOW2.3
  • PythonPython
  • chainlit
NoYesJan 14, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management