XSS in Pallets Jinja
CVE-2024-34064
Jinja is an extensible templating engine. The `xmlattr` filter in affected versions of Jinja accepts keys containing non-attribute characters. XML/HTML attributes cannot contain spaces, `/`, `>`, or `=`, as each would then be interpreted as starting 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. The fix for CVE-2024-22195 only addressed spaces but not other characters. Accepting keys as user input is now explicitly considered an unintended use case of the `xmlattr` filter, and code that does so without otherwise validating the input should be flagged as insecure, regardless of Jinja version. Accepting _values_ as user input continues to be safe. This vulnerability is fixed in 3.1.4.
Vulnerability class: XSS (Cross-Site Scripting)
Published · last modified .
CVSS v3 metric
CVSS v3 base score 5.4 (Medium). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N.
EPSS exploit prediction
EPSS 0.010, 62.7th percentile (scored ); unchanged over 30 days. About EPSS.
Affected products
- Pallets Jinja — versions < 3.1.4
- Palletsprojects Jinja
- Fedoraproject Fedora — versions 39, 40
Weakness classification (CWE)
Public exploits and proof-of-concept code
7 public repositories with exploit or proof-of-concept code for this CVE:
- SandBlastx/flask-vuln-v4 (last pushed 2026-03-10): CVE-2024-34064 demo - v4 subtle vuln good comment
- SandBlastx/flask-vuln-v3 (last pushed 2026-03-10): CVE-2024-34064 demo - v3 subtle vuln no misleading comment
- SandBlastx/flask-vuln-v2 (last pushed 2026-03-10): CVE-2024-34064 demo - v2 genuine fix bad comments
- SandBlastx/flask-vuln-v1 (last pushed 2026-03-10): CVE-2024-34064 demo - v1 genuine fix honest comments
- SandBlastx/flask-vuln-baseline (last pushed 2026-03-10): CVE-2024-34064 demo - baseline (no sanitisation)
- SandBlastx/flask-vuln-v6 (last pushed 2026-03-10): CVE-2024-34064 demo - v6 sanitisation applied to wrong variable
- SandBlastx/flask-vuln-v5 (last pushed 2026-03-10): CVE-2024-34064 demo - v5 regex missing end anchor
Also mentioned in 6 other repositories (fetter-io/fetter-py, fetter-io/fetter-rs, fkie-cad/nvd-json-data-feeds, …). These reference the CVE in a list, notes or a scanner and are not exploit code for it.
References
- https://github.com/pallets/jinja/security/advisories/GHSA-h75v-3vvj-5mfj (Vendor Advisory)
- https://github.com/pallets/jinja/commit/0668239dc6b44ef38e7a6c9f91f312fd4ca581cb (Patch)
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/… (Mailing List)
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/… (Mailing List)
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/… (Mailing List)
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/… (Mailing List)
- lists.debian.org/debian-lts-announce/2024/12/msg00009.html
This CVE has public exploit evidence. See the latest CVEs with public exploits.