CVE-2025-27516: Jinja2 vulnerable to sandbox breakout through attr filter selecting format method
N/A
CVSS Score
Basic Information
CVE ID
GHSA ID
EPSS Score
0.34101%
CWE
Published
3/5/2025
Updated
5/1/2025
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
-
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| Jinja2 | pip | <= 3.1.5 | 3.1.6 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability description clearly points to the |attr filter as the source of the sandbox bypass. The provided commit 90457bbf33b8662926ae65cdde4c4c32e756e403 modifies the do_attr function in src/jinja2/filters.py. This function is the Python implementation of the |attr filter in Jinja2. The changes in the patch show that the way attributes were accessed was altered to ensure the environment's attribute lookup (which includes sandboxing) is used, specifically by calling environment.getattr. The previous implementation directly used getattr, which, in combination with how str.format was handled, allowed the bypass. Therefore, the do_attr function, in its state before this patch, is the vulnerable function.