{"id":"CVE-2024-56326","published":"2024-12-23T15:43:49Z","modified":"2025-11-03T19:32:16Z","title":"Jinja has a sandbox breakout through indirect reference to format method","vendor":"pallets","product":"jinja","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.4,"severity":"MEDIUM","version":"4.0","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","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00522,"percentile":0.45193,"provenance":"source"},"cwes":[{"id":"CWE-1336","name":"Improper Neutralization of Special Elements Used in a Template Engine"},{"id":"CWE-693","name":"Protection Mechanism Failure"}],"references":[{"url":"https://github.com/pallets/jinja/security/advisories/GHSA-q2x7-8rv6-6q7h","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/pallets/jinja/commit/48b0687e05a5466a91cd5812d604fa37ad0943b4","tags":["x_refsource_MISC"]},{"url":"https://github.com/pallets/jinja/releases/tag/3.1.5","tags":["x_refsource_MISC"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/04/msg00022.html","tags":[]}],"priority":{"score":12.8,"factors":[{"name":"EPSS percentile","points":9.04},{"name":"CVSS severity","points":3.78}]},"vendorSlug":"pallets","affectedVersions":[{"vendor":"pallets","product":"jinja","versions":["< 3.1.5"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2024-12-27T17:50:50.460995Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"jinja2","vulnerableRanges":["<3.1.5"],"patched":["3.1.5"],"from":["GHSA-q2x7-8rv6-6q7h","PYSEC-2026-1475"],"provenance":"source"}],"summary":{"text":"Jinja, the Python templating engine from Pallets, has a flaw in its sandboxed environment that fails to detect indirect calls to str.format, because a reference to a malicious string's format method can be stored and later invoked through a filter. An attacker who can control the content of a template, with local access, low complexity, and some user interaction required, can escape the sandbox to execute arbitrary Python code, and exploitation depends on the application using custom filters that call such stored references since Jinja has no built-in filter that does.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:49:32Z"},"euvd":{"id":"EUVD-2024-3607","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2024-22195","published":"2024-01-11","fixed":"3.1.3","kev":false,"link":{"from":"CVE-2024-22195","to":"CVE-2024-56326","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:jinja2","fromFixed":"3.1.3","toFixed":"3.1.5","daysApart":347}]}},{"cve":"CVE-2024-56201","published":"2024-12-23","fixed":"3.1.5","kev":false},{"cve":"CVE-2024-56326","published":"2024-12-23","fixed":"3.1.5","kev":false}],"package":"PyPI:jinja2"}}