Miggo Logo

CVE-2016-10745: Jinja2 sandbox escape vulnerability

8.6

CVSS Score
3.0

Basic Information

EPSS Score
0.76513%
Published
4/10/2019
Updated
9/24/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
Jinja2pip< 2.8.12.8.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from two key issues: (1) SandboxedEnvironment.call() failed to detect and properly handle str.format calls, allowing attackers to bypass sandbox restrictions via Python's string formatting mechanics. The commit adds format_string() and inspect_format_method() to intercept these calls. (2) Call.as_const() did not account for sandboxed environments when evaluating expressions, permitting unsafe constant evaluation. The patch adds 'environment.sandboxed' to the volatility check. The test cases explicitly validate that {0.class} format attempts are neutralized, confirming these functions were the attack vectors.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

In P*ll*ts Jinj* ***or* *.*.*, str.*orm*t *llows * s*n**ox *s**p*.

Reasoning

T** vuln*r**ility st*ms *rom two k*y issu*s: (*) S*n**ox***nvironm*nt.**ll() **il** to **t**t *n* prop*rly **n*l* str.*orm*t **lls, *llowin* *tt**k*rs to *yp*ss s*n**ox r*stri*tions vi* Pyt*on's strin* *orm*ttin* m****ni*s. T** *ommit ***s *orm*t_str