# CVE-2024-34064: Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.4
- **CVSS:** 5.4 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: Required; Scope: Unchanged; Confidentiality impact: Low; Integrity impact: Low; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.96% (percentile 60, 2026-11-26)
- **CWE:** CWE-79
- **Aliases:** GHSA-h75v-3vvj-5mfj, PYSEC-2026-1474
- **Published:** 2024-05-06T14:20:59.000Z
- **Modified:** 2026-09-10T03:50:13.786Z

## Who should check

- Projects that depend on PyPI package jinja2 (\< 3.1.4)
- Anyone running pallets jinja \< 3.1.4

## Description

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.

## Affected and fixed versions

- PyPI `jinja2`: affected \< 3.1.4; fixed 3.1.4 (osv)
- pallets jinja: \< 3.1.4 (cvelist)

## Mitigation

- Upgrade jinja2 to 3.1.4 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-34064. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-34064.md
Affected: jinja2 < 3.1.4
Fixed in: 3.1.4

Steps:
1. Search this machine and project for jinja2 (PyPI), pallets jinja: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-34064 being exploited?

There is no confirmed exploitation: CVE-2024-34064 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.96% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-34064?

Medium: CVSS 5.4 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work.

### Which versions are affected by CVE-2024-34064?

jinja2 \< 3.1.4.

### Is there a fix for CVE-2024-34064?

Yes. Fixed in 3.1.4. Upgrade jinja2 to 3.1.4 or later.

### How do I check if I'm affected by CVE-2024-34064?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/pallets/jinja/security/advisories/GHSA-h75v-3vvj-5mfj>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2024-34064>
- vendor: <https://github.com/advisories/GHSA-h75v-3vvj-5mfj>
- patch: <https://github.com/pallets/jinja/commit/0668239dc6b44ef38e7a6c9f91f312fd4ca581cb>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SSCBHIL6BYKR5NRCBXP4XMP2CEEKGFVS/>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GCLF44KY43BSVMTE6S53B4V5WP3FRRSE/>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZALNWE3TXPPHVPSI3AZ5CTMSTAVN5UMS/>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/567XIGSZMABG6TSMYWD7MIYNJSUQQRUC/>
- other: <https://lists.debian.org/debian-lts-announce/2024/12/msg00009.html>
- other: <https://github.com/pallets/jinja>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/567XIGSZMABG6TSMYWD7MIYNJSUQQRUC>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GCLF44KY43BSVMTE6S53B4V5WP3FRRSE>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SSCBHIL6BYKR5NRCBXP4XMP2CEEKGFVS>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZALNWE3TXPPHVPSI3AZ5CTMSTAVN5UMS>
- other: <https://pypi.org/project/jinja2>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-34064>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-h75v-3vvj-5mfj> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2026-1474> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2024-34064> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-34064>
