High severity · published Mar 5, 2025
CVE-2025-27516
Jinja sandbox breakout through attr filter selecting format method
8.8
CVSS
0.5%
EPSS
No
On KEV
Description
Jinja is an extensible templating engine. Prior to 3.1.6, 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. This vulnerability is fixed in 3.1.6.
CVSS vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Attack vector
Local
Complexity
Low
Privileges
Low
User interaction
None
Confidentiality
High
Integrity
High
Availability
High
Scope
Changed
Exploitation
Is it being used?
Exploit prediction (EPSS)0.5% · higher than 43% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
JI
jinja · pallets
< 3.1.6 · source: vendor, NVD
DL
Debian Linux · Debian
11.0 · source: NVD
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2025-27516
CVE.org
https://www.cve.org/CVERecord?id=CVE-2025-27516
Patch
https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403
Vendor Advisory
https://github.com/pallets/jinja/security/advisories/GHSA-cpwx-vrp4-4pq7
lists.debian.org
https://lists.debian.org/debian-lts-announce/2025/04/msg00022.html
Mailing List
https://lists.debian.org/debian-lts-announce/2025/04/msg00045.html
More from jinja
8.8
CVE-2024-56201
Jinja has a sandbox breakout through malicious filenames
7.8
CVE-2024-56326
Jinja has a sandbox breakout through indirect reference to format method
6.1
CVE-2024-22195
Jinja vulnerable to Cross-Site Scripting (XSS)
5.4
CVE-2024-34064
Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter
