Description
Twig is a template language for PHP. Under some circumstances, the sandbox security checks are not run which allows user-contributed templates to bypass the sandbox restrictions. This vulnerability is fixed in 1.44.8, 2.16.1, and 3.14.0.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| twigphp | Twig | > 1.0.0, < 1.44.8, > 2.0.0, < 2.16.1, > 3.0.0, < 3.14.0 | — |
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.8.0-4 | — |
| Debian 13 | php-twig | 3.8.0-4 | — |
| Debian 12 | php-twig | 3.5.1-1+deb12u1 | DSA-5771-1 |
| Debian 11 | php-twig | 2.14.3-1+deb11u3 | DLA-3888-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 24.04 LTS | php-twig | 3.8.0-2ubuntu1 | USN-7549-1 |
Show 5 more (older releases, extended support, other products)Fewer releases
| 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 |
| 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 | >= 1.0.0, < 1.44.8 | 1.44.8 | GHSA-6j75-5wfj-gh66 |
| Packagist | twig/twig | >= 2.0.0, < 2.16.1 | 2.16.1 | GHSA-6j75-5wfj-gh66 |
| Packagist | twig/twig | >= 3.12.0, < 3.14.0 | 3.14.0 | GHSA-6j75-5wfj-gh66 |
| Packagist | twig/twig | >= 3.0.0, < 3.11.1 | 3.11.1 | GHSA-6j75-5wfj-gh66 |
Advisories 4
- USN-7549-1 php-twig vulnerability Ubuntu Security Notices (USN) · Apr 27, 2026
- USN-7456-1 php-twig vulnerabilities Ubuntu Security Notices (USN) · Apr 27, 2026
- DSA-5771-1 php-twig - security update Debian Security (DSA / DLA) · Mar 9, 2026
- DLA-3888-1 php-twig - security update Debian Security (DSA / DLA) · Mar 9, 2026
References
- https://github.com/twigphp/Twig/security/advisories/GHSA-6j75-5wfj-gh66
- https://github.com/twigphp/Twig/commit/11f68e2aeb526bfaf638e30d4420d8a710f3f7c6
- https://github.com/twigphp/Twig/commit/2102dd135986db79192d26fb5f5817a566e0a7de
- https://github.com/twigphp/Twig/commit/7afa198603de49d147e90d18062e7b9addcf5233