Skip to content

CVE-2024-56201 Jinja has a sandbox breakout through malicious filenames

MediumCVSS 5.4 EPSS 0.31%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: no · technical impact: total
Technology
UbuntuDebian

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.

Upgrade path

17 packages: 16 fixed.

PackageAffectedFixed inStatus
alpine/py3-jinja2(Alpine v3.18) < 3.1.5-r0 3.1.5-r0 Fixed
alpine/py3-jinja2(Alpine v3.19) < 3.1.5-r0 3.1.5-r0 Fixed
alpine/py3-jinja2(Alpine v3.20) < 3.1.5-r0 3.1.5-r0 Fixed
alpine/py3-jinja2(Alpine v3.21) < 3.1.5-r0 3.1.5-r0 Fixed
alpine/py3-jinja2(Alpine v3.22) < 3.1.5-r0 3.1.5-r0 Fixed
alpine/py3-jinja2(Alpine v3.23) < 3.1.5-r0 3.1.5-r0 Fixed
alpine/py3-jinja2(Alpine v3.24) < 3.1.5-r0 3.1.5-r0 Fixed
azure linux python-jinja2(Azure Linux 3.0) < 3.1.2-2 3.1.2-2 Fixed
cbl-mariner python-jinja2(CBL-Mariner 2.0) < 3.0.3-5 3.0.3-5 Fixed
debian/jinja2(Debian 12) < 3.1.2-1+deb12u2; = 3.1.2-1; = 3.1.2-1+deb12u1 3.1.2-1+deb12u2 Fixed
debian/jinja2(Debian 13) < 3.1.5-1 3.1.5-1 Fixed
debian/jinja2(Debian 14) < 3.1.5-1 3.1.5-1 Fixed
palletsprojects jinja >= 3.0.0, < 3.1.5 3.1.5 Fixed
pypi jinja2(PyPI) = 3.0.0; = 3.0.1; = 3.0.2; = 3.0.3 +7 more 3.1.5 Fixed
ubuntu/jinja2(Ubuntu 22.04) < 3.0.3-1ubuntu0.3 3.0.3-1ubuntu0.3 Fixed
ubuntu/jinja2(Ubuntu 24.04) < 3.1.2-1ubuntu1.2 3.1.2-1ubuntu1.2 Fixed
pallets jinja = >= 3.0.0, < 3.1.5 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
pypi jinja2(PyPI) >= 3.0.0, < 3.1.5 3.1.5
pypi jinja2(PyPI) = 3.0.0 No fix listed
pypi jinja2(PyPI) = 3.0.1 No fix listed
pypi jinja2(PyPI) = 3.0.2 No fix listed
pypi jinja2(PyPI) = 3.0.3 No fix listed
pypi jinja2(PyPI) = 3.1.0 No fix listed
pypi jinja2(PyPI) = 3.1.1 No fix listed
pypi jinja2(PyPI) = 3.1.2 No fix listed
pypi jinja2(PyPI) = 3.1.3 No fix listed
pypi jinja2(PyPI) = 3.1.4 No fix listed
cbl-mariner python-jinja2(CBL-Mariner:2.0) < 3.0.3-5 3.0.3-5
azure linux python-jinja2(Azure Linux:3.0) < 3.1.2-2 3.1.2-2
pypi jinja2(PyPI) >= 3.0.0, <= 3.1.4 No fix listed
debian/jinja2(Debian:12) < 3.1.2-1+deb12u2 3.1.2-1+deb12u2
debian/jinja2(Debian:12) = 3.1.2-1 No fix listed
debian/jinja2(Debian:12) = 3.1.2-1+deb12u1 No fix listed
debian/jinja2(Debian:13) < 3.1.5-1 3.1.5-1
debian/jinja2(Debian:14) < 3.1.5-1 3.1.5-1
ubuntu/jinja2(Ubuntu:22.04) < 3.0.3-1ubuntu0.3 3.0.3-1ubuntu0.3
pallets jinja = >= 3.0.0, < 3.1.5 No fix listed
alpine/py3-jinja2(Alpine:v3.18) < 3.1.5-r0 3.1.5-r0
alpine/py3-jinja2(Alpine:v3.19) < 3.1.5-r0 3.1.5-r0
alpine/py3-jinja2(Alpine:v3.20) < 3.1.5-r0 3.1.5-r0
alpine/py3-jinja2(Alpine:v3.21) < 3.1.5-r0 3.1.5-r0
alpine/py3-jinja2(Alpine:v3.22) < 3.1.5-r0 3.1.5-r0
Show 4 more
ProductAffected versionsFixed in
alpine/py3-jinja2(Alpine:v3.23) < 3.1.5-r0 3.1.5-r0
alpine/py3-jinja2(Alpine:v3.24) < 3.1.5-r0 3.1.5-r0
ubuntu/jinja2(Ubuntu:24.04) < 3.1.2-1ubuntu1.2 3.1.2-1ubuntu1.2
palletsprojects jinja >= 3.0.0, < 3.1.5 3.1.5

References