CVE-2024-56326Jinja has a sandbox breakout through indirect reference to format method
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.
What to do
Fixed builds are available from AlmaLinux, Alpine, Debian, PyPI, Red Hat, Rocky Linux, Ubuntu: see the table below for the fixed version per release.
Red Hat, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | jinja2 | Fixed | 3.1.2-1ubuntu1.2 | UBUNTU-CVE-2024-56326 |
| Ubuntu 22.04 | jinja2 | Fixed | 3.0.3-1ubuntu0.3 | UBUNTU-CVE-2024-56326 |
| Ubuntu 20.04 | jinja2 | Fixed | 2.10.1-2ubuntu0.4 | UBUNTU-CVE-2024-56326 |
| Ubuntu 18.04 | jinja2 | Fix pending | 2.10-1ubuntu0.18.04.1+esm3 (Ubuntu Pro) | UBUNTU-CVE-2024-56326 |
| Ubuntu 16.04 | jinja2 | Fix pending | 2.8-1ubuntu0.1+esm5 (Ubuntu Pro) | UBUNTU-CVE-2024-56326 |
| Ubuntu 14.04 | jinja2 | Fix pending | 2.7.2-2ubuntu0.1~esm6 (Ubuntu Pro) | UBUNTU-CVE-2024-56326 |
| Debian 14 | jinja2 | Fixed | 3.1.5-1 | DEBIAN-CVE-2024-56326 |
| Debian 13 | jinja2 | Fixed | 3.1.5-1 | DEBIAN-CVE-2024-56326 |
| Debian 12 | jinja2 | Fixed | 3.1.2-1+deb12u2 | DEBIAN-CVE-2024-56326 |
| Red Hat Enterprise Linux 10 | flatpak-sdk | Not affected | ||
| Red Hat Enterprise Linux 10 | python-jinja2 | Not affected | ||
| Red Hat Enterprise Linux 10 | python3-jinja2 | Not affected | ||
| Red Hat Enterprise Linux 10 | python3-jinja2+i18n | Not affected | ||
| Red Hat Enterprise Linux 9 | fence-agents | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-aliyun | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-all | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-amt-ws | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-apc | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-apc-snmp | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-aws | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-azure-arm | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-bladecenter | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-brocade | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-cisco-mds | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-cisco-ucs | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-common | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-compute | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-drac5 | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-eaton-snmp | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-emerson | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-eps | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-gce | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-heuristics-ping | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-hpblade | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ibm-powervs | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ibm-vpc | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ibmblade | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ifmib | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo-moonshot | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo-mp | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo-ssh | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo2 | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-intelmodular | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ipdu | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-ipmilan | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-kdump | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-kubevirt | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-lpar | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-mpath | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-openstack | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-redfish | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-rhevm | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-rsa | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-rsb | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-sbd | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-scsi | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-virsh | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-vmware-rest | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-vmware-soap | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-wti | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-agents-zvm | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-virt | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-virtd | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-virtd-cpg | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-virtd-libvirt | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-virtd-multicast | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-virtd-serial | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | fence-virtd-tcp | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | ha-cloud-support | Fixed | 0:4.10.0-76.el9_5.4 | RHSA-2025:0308 |
| Red Hat Enterprise Linux 9 | python-jinja2 | Fixed | 0:2.11.3-7.el9_5 | RHSA-2025:0667 |
| Red Hat Enterprise Linux 9 | python3-jinja2 | Fixed | 0:2.11.3-7.el9_5 | RHSA-2025:0667 |
| Red Hat Enterprise Linux 8 | python-jinja2 | Fixed | 0:2.10.1-6.el8_10 | RHSA-2025:0711 |
| Red Hat Enterprise Linux 8 | python3-jinja2 | Fixed | 0:2.10.1-6.el8_10 | RHSA-2025:0711 |
| Red Hat Enterprise Linux 6 | python-jinja2 | Fix pending Fix deferred | ||
| AlmaLinux 9 | fence-agents-common | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-agents-compute | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-agents-ibm-powervs | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-agents-ibm-vpc | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-agents-kubevirt | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-agents-virsh | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-virt | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-virtd | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-virtd-cpg | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-virtd-libvirt | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-virtd-multicast | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-virtd-serial | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | fence-virtd-tcp | Fixed | 4.10.0-76.el9_5.4.alma.1 | ALSA-2025:0308 |
| AlmaLinux 9 | python3-jinja2 | Fixed | 2.11.3-7.el9_5 | ALSA-2025:0667 |
| AlmaLinux 8 | python3-jinja2 | Fixed | 2.10.1-6.el8_10 | ALSA-2025:0711 |
| Rocky Linux 9 | fence-agents | Fixed | 0:4.10.0-76.el9_5.4 | RLSA-2025:0308 |
| Rocky Linux 9 | python-jinja2 | Fixed | 0:2.11.3-7.el9_5 | RLSA-2025:0667 |
| Rocky Linux 8 | python-jinja2 | Fixed | 0:2.10.1-6.el8_10 | RLSA-2025:0711 |
| Alpine Linux 3.24 | py3-jinja2 | Fixed | 3.1.5-r0 | ALPINE-CVE-2024-56326 |
| Alpine Linux 3.23 | py3-jinja2 | Fixed | 3.1.5-r0 | ALPINE-CVE-2024-56326 |
| Alpine Linux 3.22 | py3-jinja2 | Fixed | 3.1.5-r0 | ALPINE-CVE-2024-56326 |
| Alpine Linux 3.21 | py3-jinja2 | Fixed | 3.1.5-r0 | ALPINE-CVE-2024-56326 |
| Alpine Linux 3.20 | py3-jinja2 | Fixed | 3.1.5-r0 | ALPINE-CVE-2024-56326 |
| Alpine Linux 3.19 | py3-jinja2 | Fixed | 3.1.5-r0 | ALPINE-CVE-2024-56326 |
| Alpine Linux 3.18 | py3-jinja2 | Fixed | 3.1.5-r0 | ALPINE-CVE-2024-56326 |
| PyPI library | jinja2 | Fixed | 3.1.5 | GHSA-q2x7-8rv6-6q7h |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- pallets jinja: affected: < 3.1.5
References
- https://github.com/pallets/jinja/security/advisories/GHSA-q2x7-8rv6-6q7h
- https://github.com/pallets/jinja/commit/48b0687e05a5466a91cd5812d604fa37ad0943b4
- https://github.com/pallets/jinja/releases/tag/3.1.5
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.