VDB

CVE-2024-56326

CVE-2024-56326 PUBLISHED CVSS 5.4 MEDIUM

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.

PackageEcosystemFixed in
Jinja2PyPI3.1.5
py3.10-torchvision-cuda-11.8Chainguard0.18.1-r2
localstackChainguard4.1.0-r0
kubeflow-jupyter-web-appChainguard1.9.2-r3
py3.12-torchvision-cuda-12.3Chainguard0.18.1-r2
nvidia-apex-12.3Chainguard24.04.01-r1
nemoChainguard1.23.0-r6
emissaryWolfi3.9.1-r8
supersetWolfi4.1.1-r1
py3.10-vllm-cuda-12.6Chainguard0.6.6-r0
apache-beam-python-3.11-sdkChainguard2.61.0-r1
kserveWolfi0.14.1-r0

33 more packages have a fixed version. See every fix in Lookup.

Risk scores

CVSS 4.0
5.4
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

Affected products

VendorProductVersions
palletsjinja< 3.1.5
chainguardpy3.10-torchvision-cuda-11.80
chainguardlocalstack0
chainguardkubeflow-jupyter-web-app0
chainguardpy3.12-torchvision-cuda-12.30
chainguardnvidia-apex-12.30
chainguardnemo0
wolfiemissary0
wolfisuperset0
chainguardpy3.10-vllm-cuda-12.60
chainguardapache-beam-python-3.11-sdk0
wolfikserve0
chainguardansible-operator0
amazon:2023ansible-core0
chainguardkubeflow-volumes-web-app0
PyPIJinja20
amazon:2023ansible-test0
amazon:2python3-jinja20
chainguardairflow0
chainguardpy3.11-torchvision-cuda-12.30

…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

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›