CVE-2024-56201 — jinja2
Fix: pallets/jinja@767b236CVE-2024-56201 is a CWE-150 vulnerability in jinja2. A fix is available for jinja2 — see the affected versions and patch details below.
Jinja has a sandbox breakout through malicious filenames
Exploitation Status
No confirmed exploitation observed yet
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2024-56201.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
Real-World Exposure
jinja2Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
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
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | jinja2 | ≥ 3.0.0&&< 3.1.5 | 3.1.5pip install --upgrade 'jinja2==3.1.5' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for jinja2, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update jinja2 to 3.1.5 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-56201 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2024-56201 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2024-56201. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This vulnerability has rated as a IMPORTANT flaw because an attacker controlling both the template content and filename to execute arbitrary Python code, bypassing the sandbox.
| Product | Fixed in | Advisory |
|---|---|---|
| Ansible Automation Platform Execution Environments | ansible-automation-platform/ee-minimal-rhel8:2.12.10-57 | RHSA-2025:0753 |
| Ansible Automation Platform Execution Environments | ansible-automation-platform/ee-minimal-rhel8:2.12.10-59 | RHSA-2025:1101 |
| Discovery 1 for RHEL 9 | discovery/discovery-server-rhel9:1.12.0-1 | RHSA-2025:1249 |
| Ironic content for Red Hat OpenShift Container Platform 4.12 | python-jinja2-0:3.0.1-6.el9.2 | RHSA-2025:0834 |
| Ironic content for Red Hat OpenShift Container Platform 4.13 | python-jinja2-0:3.0.1-6.el9.2 | RHSA-2025:1118 |
| Red Hat Ansible Automation Platform 2.4 for RHEL 8 | automation-controller-0:4.5.17-1.el8ap | RHSA-2025:0721 |
| Red Hat Ansible Automation Platform 2.4 for RHEL 8 | ansible-automation-platform-24/lightspeed-rhel8-operator:2.4-33 | RHSA-2025:0722 |
| Red Hat Ansible Automation Platform 2.5 for RHEL 8 | ansible-automation-platform-25/lightspeed-rhel8:2.5.250107-1 | RHSA-2025:0341 |
Frequently Asked Questions
Is CVE-2024-56201 in your dependencies?
O3 Security finds CVE-2024-56201 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.