Miggo Logo

CVE-2025-27516: Jinja2 vulnerable to sandbox breakout through attr filter selecting format method

N/A

CVSS Score

Basic Information

EPSS Score
0.34101%
Published
3/5/2025
Updated
5/1/2025
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
Jinja2pip<= 3.1.53.1.6

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

*n ov*rsi**t in *ow t** Jinj* s*n**ox** *nvironm*nt int*r**ts wit* t** `|*ttr` *ilt*r *llows *n *tt**k*r t**t *ontrols t** *ont*nt o* * t*mpl*t* to *x**ut* *r*itr*ry Pyt*on *o**. To *xploit t** vuln*r**ility, *n *tt**k*r n***s to *ontrol t** *ont*nt

Reasoning

T** vuln*r**ility **s*ription *l**rly points to t** `|*ttr` *ilt*r *s t** sour** o* t** s*n**ox *yp*ss. T** provi*** *ommit `****************************************` mo*i*i*s t** `*o_*ttr` *un*tion in `sr*/jinj**/*ilt*rs.py`. T*is *un*tion is t** Py