CVE-2024-51755: Twig has unguarded calls to `__isset()` and to array-accesses when the sandbox is enabled
2.2
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.18245%
CWE
Published
11/6/2024
Updated
11/12/2024
KEV Status
No
Technology
PHP
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:N/A:N
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| twig/twig | composer | < 3.11.2 | 3.11.2 |
| twig/twig | composer | >= 3.12, < 3.14.1 | 3.14.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from two key issues: 1) In CoreExtension::getAttribute, security checks for property access were performed after isset()/array access checks, potentially triggering __isset() methods before policy validation. 2) In GetAttrExpression::compile, the generated code for array accesses didn't properly restrict non-native ArrayAccess implementations. The commit diff shows security checks were moved before isset() checks and array-like class validation was added, confirming these were the vulnerable paths. The test cases added (MagicObject/ArrayLikeObject) specifically target these scenarios.