All reports
Low

Twig has unguarded calls to `__isset()` and to array-accesses when the sandbox is enabled

Affected versions

Version ranges need review.

Composertwig/twig
Affected versions
>=1.0.0,<2.0.0|>=2.0.0,<3.0.0|>=3.0.0,<3.11.2|>=3.12.0,<3.14.1
Fixed version
Not reported
Composertwig/twig
Affected versions
< 3.11.2
Fixed version
3.11.2
Composertwig/twig
Affected versions
>= 3.12, < 3.14.1
Fixed version
3.14.1

Exploitation

CVE-2024-51755

Probability of exploitation in the next 30 days: 0.43%

FIRST EPSS · 2026-11-19

Description

Description

In a sandbox, and attacker can access attributes of Array-like objects as they were not checked by the security policy. They are now checked via the property policy and the __isset() method is now called after the security check. This is a BC break.

Resolution

The sandbox mode now ensures access to array-like's properties is allowed.

The patch for this issue is available here for the 3.11.x branch, and here for the 3.x branch.

Credits

We would like to thank Jamie Schouten for reporting the issue and Nicolas Grekas for providing the fix.

Links

Credits

  • maantje
  • nicolas-grekas
  • G-Rath