Vulnerability · Published Nov 6, 2024 · Assigned by GitHub_M
CVE-2024-51754Unguarded calls to __toString() when nesting an object into an array in Twig
Low 2.2
In plain English
A low-severity security flaw in Twig from twigphp. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.4% (higher than 38% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
Twig is a template language for PHP. 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). 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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | php-twig | 3.5.1-1+deb12u3 | DEBIAN-CVE-2024-51754 |
| Debian:13 | php-twig | 3.14.2-1 | DEBIAN-CVE-2024-51754 |
| Debian:14 | php-twig | 3.14.2-1 | DEBIAN-CVE-2024-51754 |
| Packagist | twig/twig | 3.11.2 | GHSA-6377-hfv9-hqf6 |
| Packagist | twig/twig | 3.14.1 | GHSA-6377-hfv9-hqf6 |
Affected products (as reported)
Weakness: CWE-668 · Vector: CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:N/A:N