{"id":"CVE-2024-51754","published":"2024-11-06T19:28:17Z","modified":"2025-05-29T09:03:17Z","title":"Unguarded calls to __toString() when nesting an object into an array in Twig","vendor":"twigphp","product":"Twig","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":2.2,"severity":"LOW","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:N/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0071,"percentile":0.4925,"provenance":"source"},"cwes":[{"id":"CWE-668","name":"Exposure of Resource to Wrong Sphere"}],"references":[{"url":"https://github.com/twigphp/Twig/security/advisories/GHSA-6377-hfv9-hqf6","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/twigphp/Twig/commit/2bb8c2460a2c519c498df9b643d5277117155a73","tags":["x_refsource_MISC"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/05/msg00039.html","tags":[]}],"priority":{"score":11.4,"factors":[{"name":"EPSS percentile","points":9.85},{"name":"CVSS severity","points":1.54}]},"vendorSlug":"twigphp","affectedVersions":[{"vendor":"twigphp","product":"Twig","versions":["< 3.11.2",">= 3.12.0, < 3.14.1"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-11-06T19:40:22.129936Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"Packagist","package":"twig/twig","vulnerableRanges":["<3.11.2",">=3.12, <3.14.1"],"patched":["3.11.2","3.14.1"],"from":["GHSA-6377-hfv9-hqf6"],"provenance":"source"}],"summary":{"text":"The Twig template engine for PHP contains a flaw in its sandbox, where calls to an object's __toString() method are not checked against the security policy when the object is nested inside an array or passed as an argument to a function or filter. An attacker who can supply or influence templates running under the Twig sandbox can invoke __toString() on objects the policy forbids, provided they are able to get such an object into an array or argument list and have the template evaluated in that sandboxed context.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:12:26Z"},"euvd":{"id":"EUVD-2024-3201","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2022-23614","published":"2022-02-04","fixed":"3.3.8","kev":false},{"cve":"CVE-2022-39261","published":"2022-09-28","fixed":"3.4.3","kev":false},{"cve":"CVE-2024-45411","published":"2024-09-09","fixed":"3.14.0","kev":false,"link":{"from":"CVE-2024-45411","to":"CVE-2024-51754","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Packagist:twig/twig","fromFixed":"3.11.1","toFixed":"3.11.2","daysApart":58}]}},{"cve":"CVE-2024-51754","published":"2024-11-06","fixed":"3.14.1","kev":false},{"cve":"CVE-2024-51755","published":"2024-11-06","fixed":"3.14.1","kev":false},{"cve":"CVE-2025-24374","published":"2025-01-29","fixed":"3.19.0","kev":false},{"cve":"CVE-2026-24425","published":"2026-05-20","fixed":"3.26.0","kev":false}],"package":"Packagist:twig/twig"}}