CVE-2024-51754
Unguarded calls to __toString() when nesting an object into an array in Twig
LOW 2.2
At a glance
- Source
- NVD
- EPSS
- EPSS 0.43 % · percentile 38 ()
- State
- PUBLISHED
- Published
- Updated
- Assigner
- GitHub_M
- NVD status
- Deferred
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.
Weaknesses (CWE)
- CWE-668 — Exposure of Resource to Wrong Sphere
References
Scores
| Version | Score | Vector | Scored by |
|---|---|---|---|
| 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 | GitHub_M |
| 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 | NVD · security-advisories@github.com (Secondary) |
Advisories
- GHSA-6377-hfv9-hqf6 — Twig has unguarded calls to `__toString()` when nesting an object into an array
European references
- ENISA EUVD · EUVD-2024-3201
- GCVE · GCVE-0-2024-51754
CERT-FR advisories
- CERTFR-2025-AVI-0836 — Multiples vulnérabilités dans les produits Tenable · cert.ssi.gouv.fr
Affected products
| Product | Versions |
|---|---|
| twigphp · Twig | affected < 3.11.2 ; affected >= 3.12.0, < 3.14.1 |
Sources
| Source | Licence |
|---|---|
| CVE List (CVEProject cvelistV5) | CVE Program Terms of Use |
| EPSS (FIRST.org) | FIRST — attribution requested |
| ENISA EUVD | ENISA — reproduction authorised, source acknowledged |
| CERT-FR (ANSSI) | Licence Ouverte / Etalab 2.0 |
| NVD (NIST) via fkie-cad/nvd-json-data-feeds | Public domain — this product uses data from the NVD API but is not endorsed or certified by the NVD |