CVE-2024-56326
Jinja has a sandbox breakout through indirect reference to format method
Reported by github_m · Published December 23, 2024
Jinja2 is fixed in 3.1.5 (PyPI)
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| Jinja2 | PyPI | 3.1.5 |
| py3.10-torchvision-cuda-11.8 | Chainguard | 0.18.1-r2 |
| localstack | Chainguard | 4.1.0-r0 |
| kubeflow-jupyter-web-app | Chainguard | 1.9.2-r3 |
| py3.12-torchvision-cuda-12.3 | Chainguard | 0.18.1-r2 |
| nvidia-apex-12.3 | Chainguard | 24.04.01-r1 |
| nemo | Chainguard | 1.23.0-r6 |
| emissary | Wolfi | 3.9.1-r8 |
| superset | Wolfi | 4.1.1-r1 |
| py3.10-vllm-cuda-12.6 | Chainguard | 0.6.6-r0 |
| apache-beam-python-3.11-sdk | Chainguard | 2.61.0-r1 |
| kserve | Wolfi | 0.14.1-r0 |
33 more packages have a fixed version. See every fix in Lookup.
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| pallets | jinja | < 3.1.5 |
| chainguard | py3.10-torchvision-cuda-11.8 | 0 |
| chainguard | localstack | 0 |
| chainguard | kubeflow-jupyter-web-app | 0 |
| chainguard | py3.12-torchvision-cuda-12.3 | 0 |
| chainguard | nvidia-apex-12.3 | 0 |
| chainguard | nemo | 0 |
| wolfi | emissary | 0 |
| wolfi | superset | 0 |
| chainguard | py3.10-vllm-cuda-12.6 | 0 |
| chainguard | apache-beam-python-3.11-sdk | 0 |
| wolfi | kserve | 0 |
| chainguard | ansible-operator | 0 |
| amazon:2023 | ansible-core | 0 |
| chainguard | kubeflow-volumes-web-app | 0 |
| PyPI | Jinja2 | 0 |
| amazon:2023 | ansible-test | 0 |
| amazon:2 | python3-jinja2 | 0 |
| chainguard | airflow | 0 |
| chainguard | py3.11-torchvision-cuda-12.3 | 0 |
…and 31 more
Timeline
- Dec 23, 2024 CVE Published
- Dec 24, 2024 EPSS Score (30 in total, the first dated here)
- Feb 27, 2025 Coalition ESS Score (14 in total, the first dated here)
- Dec 30, 2025 Security Advisory (43 in total, the first dated here)
- Aug 10, 2026 Distribution Patch (41 in total, the first dated here)
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2024-56326
vulnetix vdb fixes CVE-2024-56326
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2024-56326/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart
References
- https://github.com/pallets/jinja/security/advisories/GHSA-q2x7-8rv6-6q7h x_refsource_CONFIRM
- https://github.com/pallets/jinja/commit/48b0687e05a5466a91cd5812d604fa37ad0943b4 x_refsource_MISC
- https://github.com/pallets/jinja/releases/tag/3.1.5 x_refsource_MISC
- https://nvd.nist.gov/vuln/detail/CVE-2024-56326 advisory
- https://github.com/advisories/GHSA-q2x7-8rv6-6q7h advisory
- https://github.com/pallets/jinja url
- https://lists.debian.org/debian-lts-announce/2025/04/msg00022.html url