CVEfocus › CVE database › CVE-2024-56326

CVE-2024-56326Jinja has a sandbox breakout through indirect reference to format method

CVSS 5.4 MediumEPSS 0.6% (higher than 42% of CVEs)Published 2024-12-23Updated 2025-11-03Assigner: GitHub_M

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.

CWE-1336CWE-693

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

92Fixed
4Fix pending
4Not affected

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.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 24.04jinja2Fixed3.1.2-1ubuntu1.2UBUNTU-CVE-2024-56326
Ubuntu 22.04jinja2Fixed3.0.3-1ubuntu0.3UBUNTU-CVE-2024-56326
Ubuntu 20.04jinja2Fixed2.10.1-2ubuntu0.4UBUNTU-CVE-2024-56326
Ubuntu 18.04jinja2Fix pending2.10-1ubuntu0.18.04.1+esm3 (Ubuntu Pro)UBUNTU-CVE-2024-56326
Ubuntu 16.04jinja2Fix pending2.8-1ubuntu0.1+esm5 (Ubuntu Pro)UBUNTU-CVE-2024-56326
Ubuntu 14.04jinja2Fix pending2.7.2-2ubuntu0.1~esm6 (Ubuntu Pro)UBUNTU-CVE-2024-56326
Debian 14jinja2Fixed3.1.5-1DEBIAN-CVE-2024-56326
Debian 13jinja2Fixed3.1.5-1DEBIAN-CVE-2024-56326
Debian 12jinja2Fixed3.1.2-1+deb12u2DEBIAN-CVE-2024-56326
Red Hat Enterprise Linux 10flatpak-sdkNot affected
Red Hat Enterprise Linux 10python-jinja2Not affected
Red Hat Enterprise Linux 10python3-jinja2Not affected
Red Hat Enterprise Linux 10python3-jinja2+i18nNot affected
Red Hat Enterprise Linux 9fence-agentsFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-aliyunFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-allFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-amt-wsFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-apcFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-apc-snmpFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-awsFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-azure-armFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-bladecenterFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-brocadeFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-cisco-mdsFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-cisco-ucsFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-commonFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-computeFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-drac5Fixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-eaton-snmpFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-emersonFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-epsFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-gceFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-heuristics-pingFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-hpbladeFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ibm-powervsFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ibm-vpcFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ibmbladeFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ifmibFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ilo-moonshotFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ilo-mpFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ilo-sshFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ilo2Fixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-intelmodularFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ipduFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-ipmilanFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-kdumpFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-kubevirtFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-lparFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-mpathFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-openstackFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-redfishFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-rhevmFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-rsaFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-rsbFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-sbdFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-scsiFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-virshFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-vmware-restFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-vmware-soapFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-wtiFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-agents-zvmFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-virtFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-virtdFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-virtd-cpgFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-virtd-libvirtFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-virtd-multicastFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-virtd-serialFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9fence-virtd-tcpFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9ha-cloud-supportFixed0:4.10.0-76.el9_5.4RHSA-2025:0308
Red Hat Enterprise Linux 9python-jinja2Fixed0:2.11.3-7.el9_5RHSA-2025:0667
Red Hat Enterprise Linux 9python3-jinja2Fixed0:2.11.3-7.el9_5RHSA-2025:0667
Red Hat Enterprise Linux 8python-jinja2Fixed0:2.10.1-6.el8_10RHSA-2025:0711
Red Hat Enterprise Linux 8python3-jinja2Fixed0:2.10.1-6.el8_10RHSA-2025:0711
Red Hat Enterprise Linux 6python-jinja2Fix pending
Fix deferred
AlmaLinux 9fence-agents-commonFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-agents-computeFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-agents-ibm-powervsFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-agents-ibm-vpcFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-agents-kubevirtFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-agents-virshFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-virtFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-virtdFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-virtd-cpgFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-virtd-libvirtFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-virtd-multicastFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-virtd-serialFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9fence-virtd-tcpFixed4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux 9python3-jinja2Fixed2.11.3-7.el9_5ALSA-2025:0667
AlmaLinux 8python3-jinja2Fixed2.10.1-6.el8_10ALSA-2025:0711
Rocky Linux 9fence-agentsFixed0:4.10.0-76.el9_5.4RLSA-2025:0308
Rocky Linux 9python-jinja2Fixed0:2.11.3-7.el9_5RLSA-2025:0667
Rocky Linux 8python-jinja2Fixed0:2.10.1-6.el8_10RLSA-2025:0711
Alpine Linux 3.24py3-jinja2Fixed3.1.5-r0ALPINE-CVE-2024-56326
Alpine Linux 3.23py3-jinja2Fixed3.1.5-r0ALPINE-CVE-2024-56326
Alpine Linux 3.22py3-jinja2Fixed3.1.5-r0ALPINE-CVE-2024-56326
Alpine Linux 3.21py3-jinja2Fixed3.1.5-r0ALPINE-CVE-2024-56326
Alpine Linux 3.20py3-jinja2Fixed3.1.5-r0ALPINE-CVE-2024-56326
Alpine Linux 3.19py3-jinja2Fixed3.1.5-r0ALPINE-CVE-2024-56326
Alpine Linux 3.18py3-jinja2Fixed3.1.5-r0ALPINE-CVE-2024-56326
PyPI libraryjinja2Fixed3.1.5GHSA-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.

References

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.