GHSA-cpwx-vrp4-4pq7: Pip/jinja2 vulnerability

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

1 affected componentFixes available
pip/jinja2<=3.1.5
3.1.6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/Jinja2 to a version that resolves this vulnerability.

    Fixed in 3.1.6

Event History

Mar 5, 2025
Advisory Published
via GitHub·08:40 PM
Data Sourced
via GitHub·08:40 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of GHSA-cpwx-vrp4-4pq7?

GHSA-cpwx-vrp4-4pq7 is classified as a high severity vulnerability due to its ability to allow arbitrary code execution.

2

How do I fix GHSA-cpwx-vrp4-4pq7?

To fix GHSA-cpwx-vrp4-4pq7, upgrade Jinja2 to version 3.1.6 or later.

3

What causes GHSA-cpwx-vrp4-4pq7?

GHSA-cpwx-vrp4-4pq7 is caused by an oversight in how the Jinja sandboxed environment interacts with the |attr filter.

4

Who is affected by GHSA-cpwx-vrp4-4pq7?

GHSA-cpwx-vrp4-4pq7 affects users of Jinja2 versions up to and including 3.1.5.

5

Can GHSA-cpwx-vrp4-4pq7 be exploited remotely?

Yes, GHSA-cpwx-vrp4-4pq7 can be exploited remotely if an attacker can control the content of a template.

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