CVE-2025-27516 – jinja2
Package
Manager: pip
Name: jinja2
Vulnerable Version: >=0 <3.1.6
Severity
Level: Medium
CVSS v3.1: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N/E:H/RL:U/RC:C
CVSS v4.0: 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
EPSS: 0.00059 pctl0.18472
Details
Jinja2 vulnerable to sandbox breakout through attr filter selecting format method 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.
Metadata
Created: 2025-03-05T20:40:14Z
Modified: 2025-05-01T03:31:17Z
Source: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/03/GHSA-cpwx-vrp4-4pq7/GHSA-cpwx-vrp4-4pq7.json
CWE IDs: ["CWE-1336"]
Alternative ID: GHSA-cpwx-vrp4-4pq7
Finding: F422
Auto approve: 1