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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| twigphp | Twig | < 3.11.2, >= 3.12.0, < 3.14.1 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | php-twig | 3.14.2-1 | — |
| Debian 13 | php-twig | 3.14.2-1 | — |
| Debian 12 | php-twig | 3.5.1-1+deb12u3 | — |
| Debian 11 | php-twig | 2.14.3-1+deb11u4 | DLA-4186-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 24.04 LTS | php-twig | 3.8.0-2ubuntu0.1~esm1 | USN-7456-1 |
| Ubuntu Pro 22.04 LTS | php-twig | 3.3.8-2ubuntu4+esm2 | USN-7456-1 |
| Ubuntu Pro 20.04 LTS | php-twig | 2.12.5-1ubuntu0.1~esm2 | USN-7456-1 |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 18.04 LTS | twig | No fix yet | — |
| Ubuntu Pro 16.04 LTS | twig | No fix yet | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| Packagist | twig/twig | < 3.11.2 | 3.11.2 | GHSA-6377-hfv9-hqf6 |
| Packagist | twig/twig | >= 3.12, < 3.14.1 | 3.14.1 | GHSA-6377-hfv9-hqf6 |
Advisories 2
- USN-7456-1 php-twig vulnerabilities Ubuntu Security Notices (USN) · Apr 27, 2026
- DLA-4186-1 php-twig - security update Debian Security (DSA / DLA) · Mar 9, 2026