CVE-2026-133770

Sandboxed templates can rewrite application-owned Markup objects through their constructor

Low published · updated

2.1
CVSS score out of 10 · NVD (b5aa5c7f-767d-4597-9c64-3ac08b8711c6)

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.

Affected products and versions

Product / packageEcosystem / vendorVersionsFixed inSource
twig/twig composer 0 → <3.31.13.31.1 CVE.org
twig/twig twig 0 → <3.31.13.31.1 CVE.org

References