CVE-2025-27516: Jinja sandbox breakout through attr filter selecting format method

Published Mar 5, 2025
·
Updated

An oversight in how the Jinja sandboxed environment interacts with the `|attr` filter 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 use the `|attr` filter to get a reference to a string's plain format method, bypassing the sandbox. After the fix, the `|attr` filter no longer bypasses the environment's attribute lookup.

Affected Software

14 affected componentsFixes available
pip/Jinja2<=3.1.5
3.1.6
debian/jinja2<=2.11.3-1, <=3.1.2-1+deb12u2
2.11.3-1+deb11u43.1.6-1
palletsprojects Jinja<3.1.6
Debian Debian Linux=11.0
IBM Cognos Analytics<=11.2.0
IBM Cognos Analytics<=12.0
IBM Cognos Transformer<=12.0
IBM Cognos Transformer<=11.2.4
IBM Cognos Transformer<=12.1.0
IBM Cognos Analytics<=11.2.0
IBM Cognos Analytics<=12.1.0
IBM Cognos Analytics<=12.0
IBM Cognos Transformer<=11.2.4
IBM Cognos Transformer<=12.1.0

Event History

Mar 5, 2025
CVE Published
via MITRE·08:40 PM
Data Sourced
via MITRE·08:40 PM
DescriptionWeakness
Advisory Published
via GitHub·08:40 PM
Data Sourced
via Red Hat·09:01 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·09:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:15 PM
RemedyAffected Software
Mar 16, 2025
Data Sourced
via Ubuntu·11:39 AM
RemedyDescriptionSeverityAffected Software
May 26, 2026
Data Sourced
via IBM·05:05 PM
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-2025-27516?

CVE-2025-27516 is rated as a critical vulnerability due to its potential to enable arbitrary code execution.

2

How do I fix CVE-2025-27516?

To mitigate CVE-2025-27516, upgrade Jinja2 to version 3.1.6 or later.

3

Who is affected by CVE-2025-27516?

CVE-2025-27516 affects users of Jinja2 versions 3.1.5 and earlier.

4

What does CVE-2025-27516 allow an attacker to do?

CVE-2025-27516 allows an attacker to execute arbitrary Python code through controlled template content.

5

How can I identify if I'm vulnerable to CVE-2025-27516?

You can identify if you're vulnerable to CVE-2025-27516 by checking if you are using Jinja2 version 3.1.5 or earlier.

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