Miggo Logo

CVE-2024-45411:
Twig has a possible sandbox bypass

8.6

CVSS Score

Basic Information

EPSS Score
-
Published
9/9/2024
Updated
10/10/2024
KEV Status
No
Technology
TechnologyPHP

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
twig/twigcomposer>= 1.0.0, < 1.44.81.44.8
twig/twigcomposer>= 2.0.0, < 2.16.12.16.1
twig/twigcomposer>= 3.12.0, < 3.14.03.14.0
twig/twigcomposer>= 3.0.0, < 3.11.13.11.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from how security checks were handled in the include() function. The original implementation (pre-patch) checked security during template preparation via a loop that only validated Template/TemplateWrapper instances. When including templates by name (not instances) that had been cached without sandbox context, these checks were skipped. The commit diff shows the security check (checkSecurity()) was moved from the preparation phase to the runtime phase after template loading, ensuring enforcement regardless of how the template was referenced. The test cases added in CoreTest.php validate that security errors now occur at runtime when preloading occurs, confirming the function's behavior was the root cause.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### **s*ription Un**r som* *ir*umst*n**s, t** s*n**ox s**urity ****ks *r* not run w*i** *llows us*r-*ontri*ut** t*mpl*t*s to *yp*ss t** s*n**ox r*stri*tions. T** s**urity issu* **pp*ns w**n *ll t**s* *on*itions *r* m*t: * T** s*n**ox is *is**l**

Reasoning

T** vuln*r**ility st*ms *rom *ow s**urity ****ks w*r* **n*l** in t** in*lu**() *un*tion. T** ori*in*l impl*m*nt*tion (pr*-p*t**) ****k** s**urity *urin* t*mpl*t* pr*p*r*tion vi* * loop t**t only v*li**t** T*mpl*t*/T*mpl*t*Wr*pp*r inst*n**s. W**n in*l