Vulnerability · Published Sep 4, 2026 · Assigned by GitHub_M
CVE-2026-46636Twig: Sandbox method allowlist bypass via `Markup` subclass
High 8.7
In plain English
A high-severity security flaw in Twig from twigphp. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.6% (higher than 47% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
Twig is a template language for PHP. From version 1.0.0 to before version 3.27.0, SecurityPolicy::checkMethodAllowed() unconditionally whitelists all method calls on instances of Twig\Markup. Twig\Markup is not final, so subclasses inherit the bypass. An application that passes an object of a Markup-derived class into a sandboxed template (typically to mark a chunk of HTML as safe) inadvertently exposes every public method of that subclass to template authors, regardless of the configured allowedMethods list. This issue has been patched in version 3.27.0.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | php-twig | no fix listed | DEBIAN-CVE-2026-46636 |
| Debian:13 | php-twig | 3.27.0-0+deb13u1 | DEBIAN-CVE-2026-46636 |
| Debian:14 | php-twig | 3.27.0-1 | DEBIAN-CVE-2026-46636 |
| Ubuntu:25.10 | php-twig | no fix listed | UBUNTU-CVE-2026-46636 |
| Ubuntu:26.10 | php-twig | no fix listed | UBUNTU-CVE-2026-46636 |
Affected products (as reported)
Weakness: CWE-1336 · Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
References
- https://github.com/twigphp/Twig/security/advisories/GHSA-64jr-qjx4-w2fh x_refsource_CONFIRM
- https://security-tracker.debian.org/tracker/CVE-2026-46636 x_refsource_MISC
- https://security-tracker.debian.org/tracker/DSA-6311-1 x_refsource_MISC
- https://symfony.com/blog/cve-2026-46636-sandbox-filter-tag-and-function-allow-list-bypass-when-sandbox-state-changes-between-renders x_refsource_MISC
- http://github.com/twigphp/Twig/releases/tag/v3.27.0 x_refsource_MISC