CVE-2024-56201 Jinja has a sandbox breakout through malicious filenames
Attackers controlling template filename and content can execute arbitrary Python code, bypassing Jinja's sandbox in affected versions.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2024-56201?
CVE-2024-56201 is a medium-severity code injection vulnerability in pallets jinja, published on 23 Dec 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
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.
Weakness: CWE-150
Which versions are affected by CVE-2024-56201?
3 open source packages ship an affected version, including jinja2. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
jinja2 PyPI | From 3.0.0 | 3.1.5 |
jinja2 PyPI | From 3.0.0 | 3.1.5 |
jinja2 PyPI | From 3.0.0 | 3.1.5 |
Products include Palletsprojects Jinja.
How do I fix CVE-2024-56201?
Upgrade jinja2 to 3.1.5 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2024-56201 being exploited?
There is no known exploitation of CVE-2024-56201 in the wild and no public exploit code.
Other vulnerabilities in pallets jinja
Sources
Also known as ALPINE-CVE-2024-56201, AZL-54650, AZL-54660, BELL-CVE-2024-56201, CLEANSTART-2026-JN63910, CLEANSTART-2026-WJ72873 and 10 more.