cve.bz

CVE-2024-56326 palletsprojects jinja: Protection Mechanism Failure

5.4 mediumEPSS 0.5%Fix available

Medium (5.4) in palletsprojects jinja. EPSS 0.5% estimated probability of exploitation activity in the next 30 days. Fixed in jinja2 3.1.5.

On this page
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.

Severity

CVSS 4.0

5.4 medium
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

CVSS 3.1

7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS
0.5% (unchanged from 0.5% a week ago; 0.5% 30 days ago) estimated probability of exploitation activity in the next 30 days; 45th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: total, assessed 2024-12-27. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWEs
CWE-693 Protection Mechanism Failure
CWE-1336 Improper Neutralization of Special Elements Used in a Template Engine
OWASP Top 10
A06:2025 Insecure Design
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2024-56326 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2024-56326?via=ask-ai-copy and https://cve.bz/cve/CVE-2024-56326?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2024-56326 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
palletsprojects:jinjabefore 3.1.5

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-q2x7-8rv6-6q7hPyPIjinja2<3.1.53.1.5
PYSEC-2026-1475PyPIjinja2<3.1.53.1.5

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian11jinja22.11.3-1+deb11u3DLA-4126-1
Debian12jinja23.1.2-1+deb12u2DEBIAN-CVE-2024-56326
Debian13, 14jinja23.1.5-1DEBIAN-CVE-2024-56326
Ubuntu20.04:LTSjinja22.10.1-2ubuntu0.4UBUNTU-CVE-2024-56326 USN-7244-1 USN-7343-1
Ubuntu22.04:LTSjinja23.0.3-1ubuntu0.3UBUNTU-CVE-2024-56326 USN-7244-1 USN-7343-1
Ubuntu24.04:LTSjinja23.1.2-1ubuntu1.2UBUNTU-CVE-2024-56326 USN-7244-1 USN-7343-1
UbuntuPro:14.04:LTSjinja22.7.2-2ubuntu0.1~esm6UBUNTU-CVE-2024-56326 USN-7343-1
UbuntuPro:16.04:LTSjinja22.8-1ubuntu0.1+esm5UBUNTU-CVE-2024-56326 USN-7343-1
UbuntuPro:18.04:LTSjinja22.10-1ubuntu0.18.04.1+esm3UBUNTU-CVE-2024-56326 USN-7244-1 USN-7343-1
Red Hatansible_automation_platform:2.4::el8automation-controller-venv-tower0:4.5.17-1.el8apRHSA-2025:0721
Red Hatansible_automation_platform:2.4::el8, ansible_automation_platform_developer:2.4::el8, ansible_automation_platform_inside:2.4::el8python39-jinja2, python3x-jinja20:3.1.5-1.el8apRHSA-2025:0721
Red Hatansible_automation_platform:2.4::el9automation-controller-venv-tower0:4.5.17-1.el9apRHSA-2025:0721
Red Hatansible_automation_platform:2.4::el9, ansible_automation_platform_developer:2.4::el9, ansible_automation_platform_inside:2.4::el9python-jinja2, python3-jinja20:3.1.5-1.el9apRHSA-2025:0721
Red Hatansible_automation_platform:2.5::el8automation-controller-venv-tower0:4.6.7-1.el8apRHSA-2025:0777
Red Hatansible_automation_platform:2.5::el8, ansible_automation_platform_developer:2.5::el8python3.11-django0:4.2.18-1.el8apRHSA-2025:0777
Red Hatansible_automation_platform:2.5::el8, ansible_automation_platform_developer:2.5::el8, ansible_automation_platform_inside:2.5::el8python3.11-jinja20:3.1.5-1.el8apRHSA-2025:0777
Red Hatansible_automation_platform:2.5::el9automation-controller-venv-tower0:4.6.7-1.el9apRHSA-2025:0777
Red Hatansible_automation_platform:2.5::el9, ansible_automation_platform_developer:2.5::el9python3.11-django0:4.2.18-1.el9apRHSA-2025:0777
Red Hatansible_automation_platform:2.5::el9, ansible_automation_platform_developer:2.5::el9, ansible_automation_platform_inside:2.5::el9python3.11-jinja20:3.1.5-1.el9apRHSA-2025:0777
Red Hatenterprise_linux:8::appstreampython-jinja2, python3-jinja20:2.10.1-6.el8_10RHSA-2025:0711
Red Hatenterprise_linux:9::appstreamfence-virt, fence-virtd, fence-agents and 23 more0:4.10.0-76.el9_5.4RHSA-2025:0308
245 more for Red Hat in the JSON and on Red Hat's page.
SUSEEnterprise Storage 7.1, Linux Enterprise High Performance Computing 15 SP3-LTSS, Linux Enterprise High Performance Computing 15 SP4-ESPOS and 17 morepython-Jinja22.10.1-150000.3.18.1SUSE-SU-2025:0029-1
SUSELinux Enterprise High Performance Computing 15 SP4-ESPOS, Linux Enterprise High Performance Computing 15 SP4-LTSS, Linux Enterprise High Performance Computing 15 SP5-ESPOS and 7 morepython-Jinja23.1.2-150400.12.11.1SUSE-SU-2025:0006-1
SUSELinux Enterprise Module for Public Cloud 12, Manager Client Tools 12python-Jinja22.8-19.31.1SUSE-SU-2025:0016-1
SUSELinux Micro 6.0python-Jinja23.1.2-7.1SUSE-SU-2025:20117-1
SUSELinux Micro 6.1python-Jinja23.1.4-slfo.1.1_2.1SUSE-SU-2025:20254-1
openSUSELeap 15.5, Leap 15.6python-Jinja23.1.2-150400.12.11.1SUSE-SU-2025:0006-1
openSUSELeap 15.5, Leap Micro 5.5python-Jinja22.10.1-150000.3.18.1SUSE-SU-2025:0029-1
openSUSETumbleweedoci-cli3.54.1-1.1openSUSE-SU-2025:14997-1
AlmaLinux8python3-jinja22.10.1-6.el8_10ALSA-2025:0711
AlmaLinux9fence-virt, fence-virtd, fence-virtd-cpg and 10 more4.10.0-76.el9_5.4.alma.1ALSA-2025:0308
AlmaLinux9python3-jinja22.11.3-7.el9_5ALSA-2025:0667
Rocky Linux8python-jinja20:2.10.1-6.el8_10RLSA-2025:0711
Rocky Linux9python-jinja20:2.11.3-7.el9_5RLSA-2025:0667
Alpinev3.18, v3.19, v3.20 and 4 morepy3-jinja23.1.5-r0ALPINE-CVE-2024-56326
Azure Linux2python-jinja23.0.3-5AZL-54647
Azure Linux3python-jinja23.1.2-2AZL-54654
Alpaquita23py3-jinja23.1.6-r0BELL-CVE-2024-56326
Alpaquitastreampy3-jinja23.1.5-r0BELL-CVE-2024-56326

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; AlmaLinux's OSV database, MIT; Rocky Linux's errata, BSD-3-Clause; the Alpine secdb, CC BY-SA 4.0; Microsoft's Azure Linux vulnerability data, MIT; BellSoft's OSV database, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE · Alpine · Alpaquita.

Red Hat

Red Hat rates this Moderate.

Red Hat's statement

This vulnerability is rated as Moderate due to an oversight in Jinja's sandbox environment, allowing attackers to execute arbitrary Python code through controlled template content. This requires control over template content, making exploitation possible only in specific applications, thus limiting its overall impact.

Red Hat's mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.

ProductPackageStateAdvisory
Ansible Automation Platform Execution Environmentsansible-automation-platform/ee-minimal-rhel8:2.12.10-57Fixed 2025-01-28RHSA-2025:0753
Ansible Automation Platform Execution Environmentsansible-automation-platform/ee-minimal-rhel9:2.18.1-4Fixed 2025-01-28RHSA-2025:0753
Ansible Automation Platform Execution Environmentsansible-automation-platform/ee-minimal-rhel8:2.12.10-59Fixed 2025-02-05RHSA-2025:1101
Ansible Automation Platform Execution Environmentsansible-automation-platform/ee-minimal-rhel9:2.15.13-10Fixed 2025-02-05RHSA-2025:1101
Discovery 1 for RHEL 9discovery/discovery-server-rhel9:1.12.0-1Fixed 2025-02-10RHSA-2025:1249
Discovery 1 for RHEL 9discovery/discovery-ui-rhel9:1.12.0-1Fixed 2025-02-10RHSA-2025:1249
Ironic content for Red Hat OpenShift Container Platform 4.12python-jinja2-0:3.0.1-6.el9.2Fixed 2025-02-06RHSA-2025:0834
Ironic content for Red Hat OpenShift Container Platform 4.13python-jinja2-0:3.0.1-6.el9.2Fixed 2025-02-13RHSA-2025:1118
Red Hat Ansible Automation Platform 2.4 for RHEL 8automation-controller-0:4.5.17-1.el8apFixed 2025-01-27RHSA-2025:0721
Red Hat Ansible Automation Platform 2.4 for RHEL 8python3x-jinja2-0:3.1.5-1.el8apFixed 2025-01-27RHSA-2025:0721
OpenShift Lightspeedopenshift-lightspeed-tech-preview/lightspeed-service-api-rhel9Affected
Red Hat Ansible Automation Platform 1.2ansible-towerNot affected
Red Hat Ansible Automation Platform 2aap-cloud-metrics-collector-containerFix deferred
Red Hat Ansible Automation Platform 2ansible-automation-platform-24/ee-dellemc-openmanage-rhel8Not affected
Red Hat Ansible Automation Platform 2ansible-automation-platform-25/ansible-dev-tools-rhel8Not affected
Red Hat Ansible Automation Platform 2ansible-automation-platform-25/de-supported-rhel8Not affected
Red Hat Ansible Automation Platform 2ansible-automation-platform-25/platform-resource-runner-rhel8Not affected
Red Hat Developer Hub 1rhdh/rhdh-rhel9-operatorNot affected
Red Hat Enterprise Linux 10flatpak-sdkNot affected
Red Hat Enterprise Linux 10python-jinja2Not affected
338 more in the JSON and on Red Hat's page.

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2024-56326.

Attack patterns (CAPEC)

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits. More on the page of CWE-693 (17).

References

Check your stackJSON