CVE-2024-56326: Jinja has a sandbox breakout through indirect reference to format method
Vulnerability summary
CVE-2024-56326 is a high (CVSS 7.8) Protection Mechanism Failure vulnerability in pallets jinja. EPSS estimates a 0.52% chance of exploitation in the next 30 days, higher than 44.3% of scored vulnerabilities.
Not severe (CVSS 5.4, local access); no exploitation reported by the 5 checked sources
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 22 · Related 25Timeline
- 23-12-2024PublishedVulnerability first disclosed.
- 03-11-2025Last modifiedVulnerability information updated.
Description
Jinja is an extensible templating engine. Prior to 3.1.5, An oversight in how the Jinja sandboxed environment detects calls to str.format allows an attacker that controls the content of a template to execute arbitrary Python code. To exploit the vulnerability, an attacker needs to control the content 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. Jinja's sandbox does catch calls to str.format and ensures they don't escape the sandbox. However, it's possible to store a reference to a malicious string's format method, then pass that to a filter that calls it. No such filters are built-in to Jinja, but could be present through custom filters in an application. After the fix, such indirect calls are also handled by the sandbox. This vulnerability is fixed in 3.1.5.
CVSS metrics
13 scores · 9 sources · 2 versions- OSV · AlpineEcosystem advisory · calculated5.4MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- OSV · PypiEcosystem advisory · calculated5.4MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- OSV · UbuntuEcosystem advisory · calculated5.4MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- OSV · DebianEcosystem advisory · calculated5.4MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- OSV · WolfiEcosystem advisory · calculated5.4MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- OSV · ChainguardEcosystem advisory · calculated5.4MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- NVDNIST5.4MediumCVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- OSV · PypiEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- OSV · Red hatEcosystem advisory · calculated6.3MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:HDiffers
- OSV · UbuntuEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- NVDNIST7.8HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS trend
Probability
0.52%
Chance of exploitation in the next 30 days
Percentile
44%
Versus all other CVEs
30-day change
No change 0.00 pp
From 0.52% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root cause- CWE-693Protection Mechanism FailureThe product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.
- CWE-1336Improper Neutralization of Special Elements Used in a Template EngineThe product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.
Affected systems
Known conditions: local access, low-privilege account, user interaction (CVSS vector). Other conditions: not stated in public data.
Chainguard35 products
- airflow< 2.10.4-r2
- airflow-bitnami-compat< 2.10.4-r2
- ansible-operator< 1.37.1-r0
- ansible-operator-compat< 1.37.1-r0
- apache-beam-python-3.11-sdk< 2.61.0-r1
Wolfi29 products
- airflow< 2.10.4-r2
- airflow-bitnami-compat< 2.10.4-r2
- checkov< 3.2.432-r0
- dask-gateway< 2024.1.0-r13
- emissary< 3.9.1-r8
Suse22 products
- python-Jinja2&distro=SUSE Enterprise Storage 7.1< 2.10.1-150000.3.18.1
- python-Jinja2&distro=SUSE Linux Enterprise High Performance Computing 15 SP3-LTSS< 2.10.1-150000.3.18.1
- python-Jinja2&distro=SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS< 2.10.1-150000.3.18.1
- python-Jinja2&distro=SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS< 2.10.1-150000.3.18.1
- python-Jinja2&distro=SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS< 2.10.1-150000.3.18.1
Opensuse2 products
- python-Jinja2&distro=openSUSE Leap 15.5< 2.10.1-150000.3.18.1
- python-Jinja2&distro=openSUSE Leap Micro 5.5< 2.10.1-150000.3.18.1
Redhat2 products
- python-jinja2< 0:2.11.3-7.el9_5 | < 0:2.10.1-6.el8_10 | < 0:2.11.3-6.el9_4 | < 0:2.10.1-4.el8_8.1 | < 0:2.10.1-4.el8_6.1 | < 0:2.11.3-4.el9_0.1 | < 0:2.11.3-4.el9_2.1 | < 0:2.10.1-2.el8_4.1 | < 0:2.7.2-5.el7_9 | < 0:2.10.1-2.el8_2.3
- python3-jinja2< 0:2.11.3-7.el9_5 | < 0:2.10.1-6.el8_10 | < 0:2.11.3-6.el9_4 | < 0:2.10.1-4.el8_8.1 | < 0:2.10.1-4.el8_6.1 | < 0:2.11.3-4.el9_0.1 | < 0:2.11.3-4.el9_2.1 | < 0:2.10.1-2.el8_4.1 | < 0:2.10.1-2.el8_2.3
Alpine1 product
- py3-jinja2< 3.1.5-r0
Debian1 product
- jinja2< 3.1.2-1+deb12u2 | < 3.1.5-1
Mageia1 product
- python-jinja2< 3.1.5-1.mga9
Pallets1 product
- jinja< 3.1.5
Palletsprojects1 product
- jinja< 3.1.5
PyPI1 product
- jinja2< 3.1.5
Ubuntu1 product
- jinja2< 2.7.2-2ubuntu0.1~esm6 | < 2.8-1ubuntu0.1+esm5 | < 2.10-1ubuntu0.18.04.1+esm3 | < 2.10.1-2ubuntu0.4 | < 3.0.3-1ubuntu0.3 | < 3.1.2-1ubuntu1.2
12 vendors · 97 products
References
46 links- github.com/pallets/jinja/security/advisories/GHSA-q2x7-8rv6-6q7hX Refsource CONFIRMWEBARTICLEREPORTAdvisoryVendor Advisory
- github.com/pallets/jinja/commit/48b0687e05a5466a91cd5812d604fa37ad0943b4X Refsource MISCWEBFIXARTICLEPatch
Show all 46 references
- github.com/pallets/jinjaPACKAGE
- pypi.org/project/jinja2PACKAGE