CVE-2024-56326

Jinja has a sandbox breakout through indirect reference to format method

Published Dec 23, 2024 CVSS 4.0 · 5.4 Medium EPSS < 1% KEV · Not listed
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-4126-1 jinja2 security update
EUVD EUVD EUVD-2024-3607 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.
Github GHSA Github GHSA GHSA-q2x7-8rv6-6q7h Jinja has a sandbox breakout through indirect reference to format method
Ubuntu USN Ubuntu USN USN-7244-1 Jinja2 vulnerabilities
Ubuntu USN Ubuntu USN USN-7343-1 Jinja2 vulnerabilities
History
Type Values Removed Values Added
First Time appeared Palletsprojects
Palletsprojects jinja
CPEs cpe:2.3:a:palletsprojects:jinja:*:*:*:*:*:*:*:*
Vendors & Products Palletsprojects
Palletsprojects jinja
Type Values Removed Values Added
Metrics epss

{'score': 0.00103}

epss

{'score': 0.00084}

Type Values Removed Values Added
CPEs cpe:/a:redhat:satellite:6.17::el9
cpe:/a:redhat:satellite_capsule:6.17::el9
Type Values Removed Values Added
CPEs cpe:/a:redhat:rhdh:1.5::el9
Type Values Removed Values Added
CPEs cpe:/a:redhat:rhdh:1.3::el9
Type Values Removed Values Added
CPEs cpe:/a:redhat:openshift:4.13::el8
Type Values Removed Values Added
CPEs cpe:/a:redhat:rhel_aus:8.2
Type Values Removed Values Added
First Time appeared Redhat satellite
Redhat satellite Capsule
CPEs cpe:/a:redhat:satellite:6.16::el8
cpe:/a:redhat:satellite:6.16::el9
cpe:/a:redhat:satellite_capsule:6.16::el8
cpe:/a:redhat:satellite_capsule:6.16::el9
Vendors & Products Redhat satellite
Redhat satellite Capsule
Type Values Removed Values Added
CPEs cpe:/a:redhat:openshift:4.15::el8
Type Values Removed Values Added
First Time appeared Redhat openstack
CPEs cpe:/a:redhat:openstack:17.1::el9
Vendors & Products Redhat openstack
Type Values Removed Values Added
First Time appeared Redhat rhdh
CPEs cpe:/a:redhat:openshift:4.12::el8
cpe:/a:redhat:openshift_ironic:4.13::el9
cpe:/a:redhat:rhdh:1.4::el9
Vendors & Products Redhat rhdh
Type Values Removed Values Added
First Time appeared Redhat
Redhat ansible Automation Platform
Redhat discovery
Redhat enterprise Linux
Redhat openshift
Redhat openshift Ironic
Redhat rhel Aus
Redhat rhel E4s
Redhat rhel Els
Redhat rhel Eus
Redhat rhel Tus
CPEs cpe:/a:redhat:ansible_automation_platform:2.4::el8
cpe:/a:redhat:ansible_automation_platform:2.4::el9
cpe:/a:redhat:ansible_automation_platform:2.5::el8
cpe:/a:redhat:ansible_automation_platform:2.5::el9
cpe:/a:redhat:ansible_automation_platform:ee::el8
cpe:/a:redhat:enterprise_linux:8
cpe:/a:redhat:enterprise_linux:9
cpe:/a:redhat:openshift:4.16::el9
cpe:/a:redhat:openshift:4.17::el9
cpe:/a:redhat:openshift_ironic:4.12::el9
cpe:/a:redhat:openshift_ironic:4.14::el9
cpe:/a:redhat:openshift_ironic:4.15::el9
cpe:/a:redhat:openshift_ironic:4.16::el9
cpe:/a:redhat:openshift_ironic:4.17::el9
cpe:/a:redhat:rhel_aus:8.4
cpe:/a:redhat:rhel_aus:8.6
cpe:/a:redhat:rhel_e4s:8.4
cpe:/a:redhat:rhel_e4s:8.6
cpe:/a:redhat:rhel_e4s:9.0
cpe:/a:redhat:rhel_eus:8.8
cpe:/a:redhat:rhel_eus:9.2
cpe:/a:redhat:rhel_eus:9.4
cpe:/a:redhat:rhel_tus:8.4
cpe:/a:redhat:rhel_tus:8.6
cpe:/o:redhat:discovery:1.0::el9
cpe:/o:redhat:rhel_els:7
Vendors & Products Redhat
Redhat ansible Automation Platform
Redhat discovery
Redhat enterprise Linux
Redhat openshift
Redhat openshift Ironic
Redhat rhel Aus
Redhat rhel E4s
Redhat rhel Els
Redhat rhel Eus
Redhat rhel Tus
Metrics threat_severity

Important

threat_severity

Moderate

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 10, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H'}

ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 10, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H'}

ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title Jinja has a sandbox breakout through indirect reference to format method
Weaknesses CWE-1336
CWE-693
References
Metrics cvssV4_0

{'score': 5.4, 'vector': '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'}