CVE-2024-51755: Unguarded calls to __isset() and to array-accesses when the sandbox is enabled
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.
Other sources
Twig is a template language for PHP. In a sandbox, an 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. This issue has been patched in versions 3.11.2 and 3.14.1. All users are advised to upgrade. There are no known workarounds for this issue.
— NVD
Unguarded calls to isset() and to array-accesses when the sandbox is enabled
— Packagist
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/twig/twigto a version that resolves this vulnerability.Fixed in 3.14.1 - Upgrade
Upgrade
composer/twig/twigto a version that resolves this vulnerability.Fixed in 3.11.2 - Upgrade
Upgrade
debian/php-twigto a version that resolves this vulnerability.Fixed in 3.14.2-1 - Upgrade
Upgrade
debian/php-twigto a version that resolves this vulnerability.Fixed in 3.27.0-0+deb13u1Fixed in 3.30.0-1 - Upgrade
Upgrade
Twigto a version that resolves this vulnerability.Fixed in 3.11.2 - Upgrade
Upgrade
Twigto a version that resolves this vulnerability.Fixed in 3.14.1
Event History
Frequently Asked Questions
What is the severity of CVE-2024-51755?
CVE-2024-51755 has a high severity due to its potential for attackers to bypass security policies.
How do I fix CVE-2024-51755?
To fix CVE-2024-51755, update the twig/twig package to version 3.14.1 or 3.11.2.
What are the affected versions in CVE-2024-51755?
CVE-2024-51755 affects twig/twig versions between 3.12.0 and 3.14.1 and all versions before 3.11.2.
What type of security issue is CVE-2024-51755?
CVE-2024-51755 is a security issue that allows access to Array-like objects without proper validation.
Is there a backward compatibility break in CVE-2024-51755?
Yes, CVE-2024-51755 introduces a backward compatibility break due to changes in the security checks.