All vulnerabilities

Packagist

CVE-2026-133770

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

Severity
Low 2.1
Published
24 Nov 2026
Last changed
24 Nov 2026
Added to UpHeron
24 Nov 2026
Fixed in
3.31.1
Weakness
Cross-site scripting (CWE-79)Incorrect authorization (CWE-863)
Attack
Over the network · Only under certain conditions · Needs a user account · Needs someone to view a page or file
Attacker can
Change some data
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N
Sources
CVE Program

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('

', '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.

From the CVE Program.

Affected software

SoftwareAffected versions
twig/twigPackagist · osv:Packagist:twig/twig
  • Every version before 3.31.1

About twig/twig

Monthly downloads (Packagist)
14,503,338Packagist, 24 Nov 2026
Total downloads (Packagist)
517,678,663Packagist, 24 Nov 2026

References

  • CVE.org https://www.cve.org/CVERecord?id=CVE-2026-133770