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

Published Dec 23, 2024
·
Updated

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.

Affected Software

4 affected componentsFixes available
pip/jinja2<=3.1.4
3.1.5
debian/jinja2<=2.11.3-1
2.11.3-1+deb11u43.1.2-1+deb12u23.1.6-1
IBM Concert Software<=1.0.0-1.1.0
palletsprojects Jinja<3.1.5

Event History

Dec 23, 2024
CVE Published
via MITRE·03:43 PM
Data Sourced
via MITRE·03:43 PM
DescriptionWeakness
Data Sourced
via Red Hat·04:01 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·04:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·04:15 PM
RemedyAffected Software
Advisory Published
via GitHub·05:56 PM
Mar 16, 2025
Data Sourced
via Ubuntu·11:39 AM
RemedyDescriptionSeverityAffected Software
Aug 18, 2025
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-56326?

CVE-2024-56326 is classified as a high severity vulnerability due to its potential for arbitrary code execution.

2

How do I fix CVE-2024-56326?

To fix CVE-2024-56326, upgrade to Jinja2 version 3.1.5 or later.

3

Who is affected by CVE-2024-56326?

CVE-2024-56326 affects Jinja2 versions up to and including 3.1.4.

4

What type of attack does CVE-2024-56326 enable?

CVE-2024-56326 enables attackers to execute arbitrary Python code through a compromised template.

5

Is there a workaround for CVE-2024-56326?

There are no officially recommended workarounds for CVE-2024-56326; the best action is to update to the latest version.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203