CVE-2026-133766 Sandbox `__toString()` policy bypass via spread arguments
- Published
- Updated
- Exploit status
- No public exploit known
- Technology
- PHPDebian
Description
Since Twig 3.28.0, the sandbox skips the toString() check of an argument whose PHP parameter can't hold a string, like an int. A spread argument was mapped to a single parameter, although it fills every parameter from its position on. A sandboxed template could therefore call a denied toString() method:
{{ tag(...[1, obj]) }}
Here, the first parameter of tag() is an int, and a later one accepts strings. Applications are affected when they allow such a function, filter or test in the sandbox. No built-in callable is affected.
A spread argument is now checked unless every parameter that it can fill has a safe type.
Upgrade path
2 packages: 1 fixed, 1 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| debian/php-twig(Debian 14) | = 3.20.0-2; = 3.21.1-1; = 3.21.1-2; = 3.21.1-3 +19 more | No fix listed | No fix yet |
| twig/twig(Packagist) | >= 3.28.0, < 3.31.1 | 3.31.1 | Fixed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| twig/twig(Packagist) | >= 3.28.0, < 3.31.1 | 3.31.1 |
| debian/php-twig(Debian:14) | All versions | No fix listed |
| debian/php-twig(Debian:14) | = 3.20.0-2 | No fix listed |
| debian/php-twig(Debian:14) | = 3.21.1-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.21.1-2 | No fix listed |
| debian/php-twig(Debian:14) | = 3.21.1-3 | No fix listed |
| debian/php-twig(Debian:14) | = 3.22.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.22.0-2 | No fix listed |
| debian/php-twig(Debian:14) | = 3.22.1-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.22.1-2 | No fix listed |
| debian/php-twig(Debian:14) | = 3.22.1-3 | No fix listed |
| debian/php-twig(Debian:14) | = 3.22.2-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.22.2-2 | No fix listed |
| debian/php-twig(Debian:14) | = 3.23.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.23.0-2 | No fix listed |
| debian/php-twig(Debian:14) | = 3.24.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.26.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.27.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.27.1-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.28.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.30.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.31.0-1 | No fix listed |
| debian/php-twig(Debian:14) | = 3.31.1-1 | No fix listed |
| debian/php-twig(Debian:14) | = 4.0.0~alpha1-1 | No fix listed |
References
- CVE-2026-133766 vendor-advisory
- GHSA-56wp-8m9q-4354 vendor-advisory
- github.com patch
- ENISA EUVD EUVD-2026-133915 third-party-advisory
- security-tracker.debian.org vendor-advisory