CVE-2024-51754
LOW 2.2CVSS 3.1Twig has unguarded calls to `__toString()` when nesting an object into an array
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.
- Published
- 6 Nov 2024
- Last modified
- 17 Jun 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Deferred
- Weakness
- CWE-668
- Also known as
- GHSA-6377-hfv9-hqf6
- Sources
- NVDJSONOSV GHSA-6377-hfv9-hqf6JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| OSV | GitHub | CVSS 4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N | |
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | LOW 2.2 | CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:N/A:N |
| OSV | GitHub | CVSS 3.1 | LOW 2.2 | CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:N/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| OSV | Packagist | twig/twig | < 3.11.2 | 3.11.2 |
| OSV | Packagist | twig/twig | >= 3.12, < 3.14.1 | 3.14.1 |
References
- https://github.com/twigphp/Twig/commit/2bb8c2460a2c519c498df9b643d5277117155a73 · WEB
- https://github.com/twigphp/Twig/security/advisories/GHSA-6377-hfv9-hqf6 · WEB
- https://lists.debian.org/debian-lts-announce/2025/05/msg00039.html · WEB
- https://nvd.nist.gov/vuln/detail/CVE-2024-51754 · ADVISORY
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2024-51754.yaml · WEB
- https://github.com/twigphp/Twig · PACKAGE
- https://symfony.com/blog/unguarded-calls-to-__tostring-when-nesting-an-object-into-an-array · WEB
History
- 25 Nov 2026 20:56 UTC · NVD: first stored (published 6 Nov 2024)
- 25 Nov 2026 20:15 UTC · OSV: first stored (published 6 Nov 2024)