Vulnerability · Published Dec 23, 2024 · Assigned by GitHub_M

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

High 7.8

In plain English

A high-severity security flaw in jinja from pallets. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.5% (higher than 44% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.5%top 55.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:9fence-agents-common4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-agents-compute4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-agents-ibm-powervs4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-agents-ibm-vpc4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-agents-kubevirt4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-agents-virsh4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-virt4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-virtd4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-virtd-cpg4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-virtd-libvirt4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-virtd-multicast4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-virtd-serial4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:9fence-virtd-tcp4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux:8python3-jinja22.10.1-6.el8_10ALSA-2025:0711
AlmaLinux:9python3-jinja22.11.3-7.el9_5ALSA-2025:0667
Alpine:v3.20py3-jinja23.1.5-r0ALPINE-CVE-2024-56326
Alpine:v3.21py3-jinja23.1.5-r0ALPINE-CVE-2024-56326
Alpine:v3.22py3-jinja23.1.5-r0ALPINE-CVE-2024-56326
Alpine:v3.23py3-jinja23.1.5-r0ALPINE-CVE-2024-56326
Alpine:v3.24py3-jinja23.1.5-r0ALPINE-CVE-2024-56326
Debian:12jinja23.1.2-1+deb12u2DEBIAN-CVE-2024-56326
Debian:13jinja23.1.5-1DEBIAN-CVE-2024-56326
Debian:14jinja23.1.5-1DEBIAN-CVE-2024-56326
PyPIjinja23.1.5PYSEC-2026-1475
PyPIjinja23.1.5GHSA-q2x7-8rv6-6q7h
Rocky Linux:8python-jinja20:2.10.1-6.el8_10RLSA-2025:0711
Rocky Linux:9python-jinja20:2.11.3-7.el9_5RLSA-2025:0667
Ubuntu:22.04:LTSjinja23.0.3-1ubuntu0.4USN-7343-1
Ubuntu:22.04:LTSjinja23.0.3-1ubuntu0.3USN-7244-1
Ubuntu:22.04:LTSjinja23.0.3-1ubuntu0.3UBUNTU-CVE-2024-56326
Ubuntu:24.04:LTSjinja23.1.2-1ubuntu1.2USN-7244-1
Ubuntu:24.04:LTSjinja23.1.2-1ubuntu1.2UBUNTU-CVE-2024-56326
Ubuntu:24.04:LTSjinja23.1.2-1ubuntu1.3USN-7343-1

Affected products (as reported)

VendorProductVersions
pallets jinja < 3.1.5

Weakness: CWE-1336, CWE-693 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References