CVE-2025-24374: Twig security issue where escaping was missing when using null coalesce operator
When using the ?? operator, output escaping was missing for the expression on the left side of the operator.
Published Jan 29, 2025 · Updated Jan 30, 2025
Affected packages
twig/twig
- Ecosystem
- Composer (PHP)
- Affected
- >= 3.16.0, < 3.19.0
- Fixed in
- 3.19.0
- Check
composer show twig/twig
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
When using the ?? operator, output escaping was missing for the expression on the left side of the operator.
Credited to PhilETaylor, fabpot.
References
- https://github.com/twigphp/Twig/security/advisories/GHSA-3xg3-cgvq-2xwr
- https://nvd.nist.gov/vuln/detail/CVE-2025-24374
- https://github.com/twigphp/Twig/commit/38576b12f05df3cc871bf68f39ccb46b418334a3
- https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2025-24374.yaml
- https://symfony.com/blog/twig-cve-2025-24374-missing-output-escaping-for-the-null-coalesce-operator
- https://github.com/advisories/GHSA-3xg3-cgvq-2xwr
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-49981
Twig: Sandbox filter, tag and function allow-list bypass when sandbox state changes between renders for a cached `Template`
high8.7Jul 1, 2026CVE-2026-48805
Twig: Sandbox state regression in deprecated internal wrappers in `src/Resources/core.php`
lowJun 30, 2026CVE-2026-48806
Twig: Sandbox `__toString()` policy bypass via dynamic mapping keys
mediumJun 30, 2026CVE-2026-48807
Twig: Sandbox `__toString()` policy bypass via `Traversable` in `join` and `replace` filters
mediumJun 30, 2026CVE-2026-48808
Twig: Sandbox property allowlist bypass via the `column` filter under `SourcePolicyInterface`
mediumJun 30, 2026CVE-2026-24425
Twig: Possible sandbox bypass when using a source policy
high8.8No fixJun 5, 2026
