CVE-2024-56201 — Vulnerability in jinja2 — CVE Details
Jinja has a sandbox breakout through malicious filenames
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.37%). Schedule for your next planned update.
Does your project use an affected jinja2 version?
Paste your requirements.txt to check it for CVE-2024-56201 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
Advisory Timeline
- First published December 23, 2024 (703 days ago).
- Last revised September 10, 2026 — 625 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "jinja2>=3.1.5"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| jinja2 PyPI · Affected: 3.0.0, 3.0.1, 3.0.2, 3.0.3 (+5 more) | 3.1.5 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-150
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 8.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/pallets/jinja/security/advisories/GHSA-gmj6-6f8f-6699WEB
- https://nvd.nist.gov/vuln/detail/CVE-2024-56201ADVISORY
- https://github.com/pallets/jinja/issues/1792WEB
- https://github.com/pallets/jinja/commit/767b23617628419ae3709ccfb02f9602ae9fe51fWEB
- https://github.com/pallets/jinjaPACKAGE
- https://github.com/pallets/jinja/releases/tag/3.1.5WEB
Frequently Asked Questions
- What is CVE-2024-56201?
- Jinja has a sandbox breakout through malicious filenames. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 8.8/10).
- How do I check if my project is affected by CVE-2024-56201?
- CVE-2024-56201 affects jinja2. It has a 0.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-56201 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 22.9% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2025-27516HIGH
Jinja2 vulnerable to sandbox breakout through attr filter selecting format method
- CVE-2024-56326HIGH
Jinja has a sandbox breakout through indirect reference to format method
- CVE-2024-34064MEDIUM
Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter
- CVE-2026-129221MEDIUM
NLTK: ARFF_Formatter Injects Weka ARFF Schema Directives via Attacker-Controlled Class Labels
- CVE-2025-27516MEDIUM
Jinja2 vulnerable to sandbox breakout through attr filter selecting format method
- CVE-2024-34064MEDIUM
Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter
- CVE-2026-128140MEDIUM
NLTK: Downloader cyclic collection indices cause an infinite closure walk
- CVE-2024-56326MEDIUM
Jinja has a sandbox breakout through indirect reference to format method