Skip to main content

CVE-2024-34064 — Vulnerability in jinja2 — CVE Details

MEDIUM

Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter

Published May 6, 2024Updated September 10, 2026Source: OSV

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.

Check my requirements.txt

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
Update jinja2 to 3.1.4 or later
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).

PackageFixed 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-79
    Cross-site Scripting (XSS)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 5.4 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

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

CVSS Score
5.4

Exploitation requires specific conditions, or the impact is limited.

EPSS Score (30-day exploit probability)
0.96%
EPSS percentile: 60.1

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

GHSA-h75v-3vvj-5mfj
PYSEC-2026-1474

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my requirements.txt