CVE-2024-34064 — Vulnerability in jinja2 — CVE Details
Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.96%). Schedule for your next planned update.
Does your project use an affected jinja2 version?
Paste your requirements.txt to check it for CVE-2024-34064 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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 the previous GHSA-h5c8-rqwp-cp95 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.
Advisory Timeline
- First published May 6, 2024 (934 days ago).
- Last revised September 10, 2026 — 857 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "jinja2>=3.1.4"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| jinja2 PyPI · Affected: 2.0, 2.0rc1, 2.1, 2.1.1 (+45 more) | 3.1.4 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-79Cross-site Scripting (XSS)MITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 5.4 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
References
- https://github.com/pallets/jinja/security/advisories/GHSA-h75v-3vvj-5mfjWEB
- https://nvd.nist.gov/vuln/detail/CVE-2024-34064ADVISORY
- https://github.com/pallets/jinja/commit/0668239dc6b44ef38e7a6c9f91f312fd4ca581cbWEB
- https://github.com/pallets/jinjaPACKAGE
- https://lists.debian.org/debian-lts-announce/2024/12/msg00009.htmlWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/567XIGSZMABG6TSMYWD7MIYNJSUQQRUCWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GCLF44KY43BSVMTE6S53B4V5WP3FRRSEWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SSCBHIL6BYKR5NRCBXP4XMP2CEEKGFVSWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZALNWE3TXPPHVPSI3AZ5CTMSTAVN5UMSWEB
Frequently Asked Questions
- What is CVE-2024-34064?
- Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 5.4/10).
- How do I check if my project is affected by CVE-2024-34064?
- CVE-2024-34064 affects jinja2. It has a 1.0% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-34064 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is an above-median EPSS score — 60.1% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2025-27516HIGH
Jinja2 vulnerable to sandbox breakout through attr filter selecting format method
- CVE-2024-56201HIGH
Jinja has a sandbox breakout through malicious filenames
- CVE-2024-56326HIGH
Jinja has a sandbox breakout through indirect reference to format method
- CVE-2026-129221MEDIUM
NLTK: ARFF_Formatter Injects Weka ARFF Schema Directives via Attacker-Controlled Class Labels
- CVE-2025-27516MEDIUM
Jinja2 vulnerable to sandbox breakout through attr filter selecting format method
- CVE-2024-56201MEDIUM
Jinja has a sandbox breakout through malicious filenames
- CVE-2026-128140MEDIUM
NLTK: Downloader cyclic collection indices cause an infinite closure walk
- CVE-2024-56326MEDIUM
Jinja has a sandbox breakout through indirect reference to format method