First published: Wed Nov 06 2024(Updated: )
### Description In a sandbox, an attacker can call `__toString()` on an object even if the `__toString()` method is not allowed by the security policy when the object is part of an array or an argument list (arguments to a function or a filter for instance). ### Resolution The sandbox mode now checks the `__toString()` method call on all objects. The patch for this issue is available [here](https://github.com/twigphp/Twig/commit/cafc608ece310e62a35a76f17e25c04ab9ed05cc) for the 3.11.x branch, and [here](https://github.com/twigphp/Twig/commit/d4a302681bca9f7c6ce2835470d53609cdf3e23e) for the 3.x branch. ### Credits We would like to thank Jamie Schouten for reporting the issue and Fabien Potencier for providing the fix.
Credit: security-advisories@github.com security-advisories@github.com
Affected Software | Affected Version | How to fix |
---|---|---|
composer/twig/twig | >=3.12<3.14.1 | 3.14.1 |
composer/twig/twig | <3.11.2 | 3.11.2 |
debian/php-twig | <=2.14.3-1+deb11u2<=2.14.3-1+deb11u3<=3.5.1-1+deb12u1 | 3.20.0-2 |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
The severity of CVE-2024-51754 is classified as medium, indicating potential risk to affected applications.
To fix CVE-2024-51754, update the twig/twig package to version 3.14.1 or 3.11.2 as per the resolution guidelines.
CVE-2024-51754 affects twig/twig versions between 3.12.0 and 3.14.1, as well as all versions below 3.11.2.
Yes, CVE-2024-51754 can be exploited in a sandbox environment where an attacker can call the __toString() method on an object.
CVE-2024-51754 is a vulnerability that allows an attacker to bypass security policies related to the __toString() method in specific contexts.