CVE-2024-51754
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.
Predictions
Heuristic predictions, AS-IS, for prioritization only.
Mitigations
No mitigations published for this CVE yet.
The vendor-content worker queues fetches as references arrive (check back in a few minutes). Or โ if you've already worked around this in production โ publish your fix to the community-verified tier.
โ Propose a mitigation on Community โ Mitigations published via the community go through AI scoring + 2 human reviewers + 7-day silent objection window before landing here withsource_tier=community-verified.
OS impact
Debian Fixed 5 releases
| Version | Status | Fixed in |
|---|---|---|
| trixie | Fixed | 3.14.2-1 |
| sid | Fixed | 3.14.2-1 |
| forky | Fixed | 3.14.2-1 |
| bullseye | Fixed | 2.14.3-1+deb11u4 |
| bookworm | Fixed | 3.5.1-1+deb12u3 |
References
- https://github.com/twigphp/Twig/security/advisories/GHSA-6377-hfv9-hqf6
- https://nvd.nist.gov/vuln/detail/CVE-2024-51754
- https://github.com/twigphp/Twig/commit/2bb8c2460a2c519c498df9b643d5277117155a73
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2024-51754.yaml
- https://github.com/twigphp/Twig
- https://lists.debian.org/debian-lts-announce/2025/05/msg00039.html
- https://symfony.com/blog/unguarded-calls-to-__tostring-when-nesting-an-object-into-an-array
- https://security-tracker.debian.org/tracker/CVE-2024-51754
Community-verified mitigations for this CVE will appear above when contributors publish them.
Verify integrity in audit chain (admin only). AS-IS.