Sandboxed templates can rewrite application-owned `Markup` objects through their constructor
- State
- Published
- Severity
- 2.1 Low
- Published
- Nov 24, 2026
- Updated
- Nov 24, 2026
- Reserved
- Nov 20, 2026
Description
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('<script>alert(1)</script>', '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.
| Product | Versions |
|---|---|
| twig/twig Twig | before 3.31.1 Affected |
| CVSS | Score | How It's Reached | Source |
|---|---|---|---|
| 4.0 | 2.1 Low | Symfony |
Weaknesses
References
- CVE-2026-133770Vendor Advisory
- GHSA-r34x-hh9h-9q9cVendor Advisory
- https://github.com/twigphp/Twig/commit/97b2e40b1165e6a42a197843f96ccb0a55f46f34Patch
Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.