Vulnerability · Published Dec 23, 2024 · Assigned by GitHub_M
CVE-2024-56201Jinja has a sandbox breakout through malicious filenames
Medium 5.4
In plain English
A medium-severity security flaw 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 0.3% (higher than 24% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
Jinja is an extensible templating engine. In versions on the 3.x branch prior to 3.1.5, a bug in the Jinja compiler allows an attacker that controls both the content and filename of a template to execute arbitrary Python code, regardless of if Jinja's sandbox is used. To exploit the vulnerability, an attacker needs to control both the filename and the contents of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates where the template author can also choose the template filename. This vulnerability is fixed in 3.1.5.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux:9 | fence-agents-common | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-agents-compute | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-agents-ibm-powervs | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-agents-ibm-vpc | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-agents-kubevirt | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-agents-virsh | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-virt | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-virtd | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-virtd-cpg | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-virtd-libvirt | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-virtd-multicast | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-virtd-serial | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux:9 | fence-virtd-tcp | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| Alpine:v3.20 | py3-jinja2 | 3.1.5-r0 | ALPINE-CVE-2024-56201 |
| Alpine:v3.21 | py3-jinja2 | 3.1.5-r0 | ALPINE-CVE-2024-56201 |
| Alpine:v3.22 | py3-jinja2 | 3.1.5-r0 | ALPINE-CVE-2024-56201 |
| Alpine:v3.23 | py3-jinja2 | 3.1.5-r0 | ALPINE-CVE-2024-56201 |
| Alpine:v3.24 | py3-jinja2 | 3.1.5-r0 | ALPINE-CVE-2024-56201 |
| Debian:12 | jinja2 | 3.1.2-1+deb12u2 | DEBIAN-CVE-2024-56201 |
| Debian:13 | jinja2 | 3.1.5-1 | DEBIAN-CVE-2024-56201 |
| Debian:14 | jinja2 | 3.1.5-1 | DEBIAN-CVE-2024-56201 |
| PyPI | jinja2 | 3.1.5 | GHSA-gmj6-6f8f-6699 |
| PyPI | jinja2 | 3.1.5 | PYSEC-2026-1472 |
| Ubuntu:22.04:LTS | jinja2 | 3.0.3-1ubuntu0.4 | USN-7343-1 |
| Ubuntu:22.04:LTS | jinja2 | 3.0.3-1ubuntu0.3 | USN-7244-1 |
| Ubuntu:22.04:LTS | jinja2 | 3.0.3-1ubuntu0.3 | UBUNTU-CVE-2024-56201 |
| Ubuntu:24.04:LTS | jinja2 | 3.1.2-1ubuntu1.2 | UBUNTU-CVE-2024-56201 |
| Ubuntu:24.04:LTS | jinja2 | 3.1.2-1ubuntu1.2 | USN-7244-1 |
| Ubuntu:24.04:LTS | jinja2 | 3.1.2-1ubuntu1.3 | USN-7343-1 |
Affected products (as reported)
Weakness: CWE-150 · Vector: CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
References
- https://github.com/pallets/jinja/security/advisories/GHSA-gmj6-6f8f-6699 x_refsource_CONFIRM
- https://github.com/pallets/jinja/issues/1792 x_refsource_MISC
- https://github.com/pallets/jinja/commit/767b23617628419ae3709ccfb02f9602ae9fe51f x_refsource_MISC
- https://github.com/pallets/jinja/releases/tag/3.1.5 x_refsource_MISC