Sandboxed templates can rewrite application-owned `Markup` objects through their constructor
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| Twigtwig/twig |
< 3.31.1→ 3.31.1 |
3.31.1 |
Fix status by distribution
Records published by each distribution for this CVE. Fixed versions differ by release; check each link.
- Debian DEBIAN-CVE-2026-133770 php-twig Fix available
Original description The description as published by the source.
The sandbox allows every method of Twig\Markup objects, including their public constructor. A sandboxed template can therefore call __construct() on any Markup object that it reaches, and replace its content:
{% do banner.__construct('alert(1)', 'UTF-8') %}
A template gains nothing by rewriting its own output. The impact is on the Markup objects that come from the application and are also rendered elsewhere, like a global in a long-running worker. Their new content then ends up in trusted pages that aren't sandboxed.
The sandbox no longer allows calling the constructor of Markup objects.
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory symfony.com
- advisory github.com
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- patch github.com
- web packagist.org