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.
Advisories
Source ID Title
Debian DLA Debian DLA DLA-4186-1 php-twig security update
EUVD EUVD EUVD-2024-3201 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.
Github GHSA Github GHSA GHSA-6377-hfv9-hqf6 Twig has unguarded calls to `__toString()` when nesting an object into an array
Ubuntu USN Ubuntu USN USN-7456-1 Twig vulnerabilities
Fixes

Solution

No solution given by the vendor.


Workaround

No workaround given by the vendor.

History

Sat, 12 Jul 2025 13:45:00 +0000

Type Values Removed Values Added
Metrics epss

{'score': 0.0009}

epss

{'score': 0.00097}


Thu, 29 May 2025 09:30:00 +0000

Type Values Removed Values Added
References

Wed, 06 Nov 2024 20:15:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 06 Nov 2024 19:45:00 +0000

Type Values Removed Values Added
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.
Title Unguarded calls to __toString() when nesting an object into an array in Twig
Weaknesses CWE-668
References
Metrics cvssV3_1

{'score': 2.2, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:N/A:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2025-05-29T09:03:17.579Z

Reserved: 2024-10-31T14:12:45.791Z

Link: CVE-2024-51754

cve-icon Vulnrichment

Updated: 2025-05-29T09:03:17.579Z

cve-icon NVD

Status : Awaiting Analysis

Published: 2024-11-06T20:15:05.817

Modified: 2025-05-29T09:15:23.197

Link: CVE-2024-51754

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

No data.