Vulnerability · Published May 6, 2024 · Assigned by GitHub_M
CVE-2024-34064Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter
Medium 5.4
In plain English
A medium-severity cross-site scripting in jinja from pallets. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.0% (higher than 62% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux:9 | fence-agents-aliyun | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-all | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-amt-ws | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-apc | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-apc-snmp | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-aws | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-azure-arm | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-bladecenter | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-brocade | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-cisco-mds | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-cisco-ucs | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-common | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-compute | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-drac5 | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-eaton-snmp | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-emerson | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-eps | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-gce | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-heuristics-ping | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-hpblade | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ibm-powervs | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ibm-vpc | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ibmblade | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ifmib | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ilo-moonshot | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ilo-mp | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ilo-ssh | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ilo2 | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-intelmodular | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ipdu | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-ipmilan | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-kdump | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-kubevirt | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-lpar | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-mpath | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-openstack | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-redfish | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-rhevm | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-rsa | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-rsb | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-sbd | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-scsi | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-virsh | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-vmware-rest | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-vmware-soap | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-wti | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-agents-zvm | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-virt | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-virtd | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-virtd-cpg | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-virtd-libvirt | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-virtd-multicast | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-virtd-serial | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | fence-virtd-tcp | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:9 | ha-cloud-support | 4.10.0-62.el9_4.3 | ALSA-2024:3820 |
| AlmaLinux:8 | python3-jinja2 | 2.10.1-5.el8_10 | ALSA-2024:4231 |
| AlmaLinux:9 | python3-jinja2 | 2.11.3-6.el9 | ALSA-2024:9150 |
| Alpine:v3.20 | py3-jinja2 | 3.1.4-r0 | ALPINE-CVE-2024-34064 |
| Alpine:v3.21 | py3-jinja2 | 3.1.4-r0 | ALPINE-CVE-2024-34064 |
| Alpine:v3.22 | py3-jinja2 | 3.1.4-r0 | ALPINE-CVE-2024-34064 |
| Alpine:v3.23 | py3-jinja2 | 3.1.4-r0 | ALPINE-CVE-2024-34064 |
| Alpine:v3.24 | py3-jinja2 | 3.1.4-r0 | ALPINE-CVE-2024-34064 |
| Debian:12 | jinja2 | 3.1.2-1+deb12u1 | DEBIAN-CVE-2024-34064 |
| Debian:13 | jinja2 | 3.1.3-1.1 | DEBIAN-CVE-2024-34064 |
| Debian:14 | jinja2 | 3.1.3-1.1 | DEBIAN-CVE-2024-34064 |
| PyPI | jinja2 | 3.1.4 | PYSEC-2026-1474 |
| PyPI | jinja2 | 3.1.4 | GHSA-h75v-3vvj-5mfj |
| Rocky Linux:9 | fence-agents | 0:4.10.0-62.el9_4.3 | RLSA-2024:3820 |
| Rocky Linux:8 | python-jinja2 | 0:2.10.1-5.el8_10 | RLSA-2024:4231 |
| Rocky Linux:9 | python-jinja2 | 0:2.11.3-6.el9 | RLSA-2024:9150 |
| Ubuntu:22.04:LTS | jinja2 | 3.0.3-1ubuntu0.2 | USN-6787-1 |
| Ubuntu:22.04:LTS | jinja2 | 3.0.3-1ubuntu0.2 | UBUNTU-CVE-2024-34064 |
| Ubuntu:24.04:LTS | jinja2 | 3.1.2-1ubuntu1.1 | USN-6787-1 |
| Ubuntu:24.04:LTS | jinja2 | 3.1.2-1ubuntu1.1 | UBUNTU-CVE-2024-34064 |
Affected products (as reported)
Weakness: CWE-79 · Vector: 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-5mfj x_refsource_CONFIRM
- https://github.com/pallets/jinja/commit/0668239dc6b44ef38e7a6c9f91f312fd4ca581cb x_refsource_MISC
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SSCBHIL6BYKR5NRCBXP4XMP2CEEKGFVS/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GCLF44KY43BSVMTE6S53B4V5WP3FRRSE/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZALNWE3TXPPHVPSI3AZ5CTMSTAVN5UMS/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/567XIGSZMABG6TSMYWD7MIYNJSUQQRUC/
- https://lists.debian.org/debian-lts-announce/2024/12/msg00009.html