Skip to main content

Twig Twig

9 CVEs product

Monthly

CVE-2026-133772 Nov 24, 13:07 LOW PATCH Monitor

Twig's sandbox allow-list can be bypassed in versions 3.15.0 through 3.30.x, letting a template author activate the otherwise-forbidden extends, use, macro and block tags by placing them in the non-selected branch of a guard tag. The attacker must be able to author or supply the sandboxed template and the sandbox policy must explicitly permit guard, and the templates reached through the loader remain sandboxed, so this is a policy-enforcement bypass rather than a full sandbox escape or code execution path. Vendor-released patch: 3.31.0; no public exploit identified at time of analysis.

PHP Authentication Bypass Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
2.3
EPSS
0.5%
CVE-2026-133771 Nov 24, 13:07 LOW PATCH Monitor

Twig's autoescaping logic can print attacker-controlled values without HTML escaping when a template contains a macro import alias whose name is also reused as an ordinary variable in a different block or macro, producing reflected/stored XSS in pages rendered with that template. Only Twig branches before 3.31.0 are affected (the composer package twig/twig, per CPE cpe:2.3:a:twig:twig), and exploitation is conditional on an application already containing that specific alias/variable name collision plus attacker influence over the rendered value; the assessed vector (CVSS 3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N) reflects that precondition and the need for a victim to load the affected page. No public exploit code and no confirmed active exploitation were identified at time of analysis, and the vendor-supplied fix is a rule removal in the escaper rather than a runtime mitigation escape hatch.

PHP XSS Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
2.3
EPSS
0.7%
CVE-2026-133770 Nov 24, 13:07 LOW PATCH Monitor

The Twig sandbox extension can be abused to rewrite application-owned Twig\Markup objects: a sandboxed template is allowed to call __construct() on any Markup instance it can reach and replace that object's content with attacker-chosen HTML, which is then rendered unescaped in trusted, non-sandboxed pages that reuse the same object. Affected are twig/twig releases before 3.31.1 (fixed in 3.31.1) whenever the sandbox extension is enabled; real-world impact additionally requires an application-owned Markup object reachable from the sandboxed template and a deployment pattern that renders that same object elsewhere, such as a global in a long-running worker. Priority is monitor: the exploit path needs sandboxed template authoring rights, a non-default shared-Markup architecture, and a victim viewing the poisoned trusted page, and no public exploit code was identified at time of analysis.

XSS Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
2.1
EPSS
0.6%
CVE-2026-133768 Nov 24, 13:07 MEDIUM PATCH This Month

Sandboxed Twig templates that are permitted to use the `join` filter can disclose the private and protected properties of non-iterable objects, bypassing the sandbox security policy's property allow-list. The filter cast non-iterable values with `(array) $value`, which expands any object into all of its properties - including ones the policy denies and that templates cannot read through any other construct - so a construct such as `{{ user|join(',') }}` printed them. Only applications that run Twig in sandbox mode with a policy that allows `join`, and where a non-iterable domain object is reachable in the template context, are affected; an attacker must be able to author or submit template source in that sandbox (authenticated per the CVSS vector, PR:L), impact is confined to property-value disclosure with no write or code-execution path, and no public exploit was identified at time of analysis.

PHP Authentication Bypass Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
5.3
EPSS
0.5%
CVE-2026-133767 Nov 24, 13:07 MEDIUM PATCH This Month

Twig's security sandbox allow-list can be bypassed by a sandboxed template that uses the `embed` tag with a parent expression other than a plain string literal or bare variable, letting a low-privileged template author invoke functions, filters, tests and `__toString()` methods the policy forbids - for example {% embed 'leak_' ~ app_secret() %} - which can expose application data through the resulting template name. The flaw affects Twig releases before 3.31.1 that actually run the SandboxExtension and permit the `embed` tag; applications using Twig without the sandbox, or whose policy forbids `embed`, are not exposed. No public exploit identified at time of analysis; the vendor-released patch is Twig 3.31.1, and method calls and property reads were never affected because they are enforced at runtime. Reported by Ivan Tse and fixed by Fabien Potencier.

Information Disclosure Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
5.3
EPSS
0.5%
CVE-2026-133766 Nov 24, 13:07 LOW PATCH Monitor

The Twig sandbox extension for PHP can be bypassed in versions 3.28.0 through 3.31.0, letting a sandboxed template reach a __toString() method that the security policy explicitly denies. An authenticated attacker who can supply template source to an application that runs the sandbox - and that has allow-listed a custom function, filter, or test whose PHP signature takes a non-string parameter (such as an int) followed by a string-accepting or variadic parameter - can use spread syntax such as {{ tag(...[1, obj]) }} to slip an object past the stringification check. Impact is limited to information disclosure through the denied __toString() call, with no code execution, write, or denial of service; no built-in Twig callable is affected, so exploitation requires a non-default allow-listed callable, and no public exploit has been identified at time of analysis (CISA KEV: not listed; priority label: monitor). Vendor-released patch: 3.31.1.

PHP Information Disclosure Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
2.3
EPSS
0.5%
CVE-2026-133765 Nov 24, 13:07 MEDIUM PATCH This Month

Sandbox policy bypass in Twig 3.23.0 through 3.31.0 lets whoever supplies the template source force the engine to invoke a __toString() method that the sandbox policy explicitly denies, exposing that object's string representation in the rendered output. The regression arrived with Twig 3.23.0's change making assignment (x = obj) and destructuring ([a] = list, {a} = obj) expressions evaluate to the value they assign; SandboxNodeVisitor wrapped filter and function results but not these new expression results, so constructs such as {{ (x = obj) }} or {{ ({secret: s} = obj)|join }} reach __toString() with no tag allowed at all. Exposure is confined to applications that render attacker-influenced template content under the Twig sandbox - the independent assessment rates it medium (CVSS 3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N, low confidentiality only), no public exploit code was identified at time of analysis, and the vendor patch ships in 3.31.1.

PHP Information Disclosure Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
5.3
EPSS
0.5%
CVE-2026-133764 Nov 24, 13:07 LOW PATCH Monitor

The sandbox guard that governs when a template may call `__toString()` on an object can be bypassed in Twig (twig/twig) before 3.31.1, letting a template author force string conversion of an object the sandbox never authorized, and thereby read whatever that object's `__toString()` returns. Exposure is narrow: the application must have registered a custom Twig test whose PHP callable coerces its input to a string (a parameter typed `string` or an explicit `(string)` cast) and must allow that test inside the sandbox policy; no built-in test is affected, so stock configurations are not exploitable, and the assessed vector (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N) caps impact at limited confidentiality disclosure with a low-privileged actor who can supply sandboxed template content. A vendor patch exists in 3.31.1; no public exploit identified at time of analysis, and the current priority signal is monitor.

PHP Information Disclosure Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
2.3
EPSS
0.5%
CVE-2026-133763 Nov 24, 13:07 MEDIUM PATCH This Month

A sandbox policy bypass in the Twig template engine (versions 3.21.0 through 3.30.x, fixed in 3.31.1) lets a template author convert a sandbox-denied object to a string and read its `__toString()` output. When a sandboxed template evaluates `{{ obj is true }}` - or the same test result concatenated or passed to a filter - the interpreter coerces the object to a string without the sandbox's method-allowlist check, so only template-authoring capability inside the sandbox is needed and no Twig tag has to be allowed. Impact is limited to information disclosure of an object's string representation; a test used purely in a boolean context such as `{% if obj is true %}` does not trigger it. No public exploit code was identified at time of analysis, the issue is not in CISA KEV, and the vendor has released a patch.

PHP Information Disclosure Twig Twig Twig
NVD GitHub VulDB
CVSS 4.0
5.3
EPSS
0.5%
EPSS 1% CVSS 2.3
LOW PATCH Monitor

Twig's sandbox allow-list can be bypassed in versions 3.15.0 through 3.30.x, letting a template author activate the otherwise-forbidden extends, use, macro and block tags by placing them in the non-selected branch of a guard tag. The attacker must be able to author or supply the sandboxed template and the sandbox policy must explicitly permit guard, and the templates reached through the loader remain sandboxed, so this is a policy-enforcement bypass rather than a full sandbox escape or code execution path. Vendor-released patch: 3.31.0; no public exploit identified at time of analysis.

PHP Authentication Bypass Twig +1
NVD GitHub VulDB
EPSS 1% CVSS 2.3
LOW PATCH Monitor

Twig's autoescaping logic can print attacker-controlled values without HTML escaping when a template contains a macro import alias whose name is also reused as an ordinary variable in a different block or macro, producing reflected/stored XSS in pages rendered with that template. Only Twig branches before 3.31.0 are affected (the composer package twig/twig, per CPE cpe:2.3:a:twig:twig), and exploitation is conditional on an application already containing that specific alias/variable name collision plus attacker influence over the rendered value; the assessed vector (CVSS 3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N) reflects that precondition and the need for a victim to load the affected page. No public exploit code and no confirmed active exploitation were identified at time of analysis, and the vendor-supplied fix is a rule removal in the escaper rather than a runtime mitigation escape hatch.

PHP XSS Twig +1
NVD GitHub VulDB
EPSS 1% CVSS 2.1
LOW PATCH Monitor

The Twig sandbox extension can be abused to rewrite application-owned Twig\Markup objects: a sandboxed template is allowed to call __construct() on any Markup instance it can reach and replace that object's content with attacker-chosen HTML, which is then rendered unescaped in trusted, non-sandboxed pages that reuse the same object. Affected are twig/twig releases before 3.31.1 (fixed in 3.31.1) whenever the sandbox extension is enabled; real-world impact additionally requires an application-owned Markup object reachable from the sandboxed template and a deployment pattern that renders that same object elsewhere, such as a global in a long-running worker. Priority is monitor: the exploit path needs sandboxed template authoring rights, a non-default shared-Markup architecture, and a victim viewing the poisoned trusted page, and no public exploit code was identified at time of analysis.

XSS Twig Twig Twig
NVD GitHub VulDB
EPSS 1% CVSS 5.3
MEDIUM PATCH This Month

Sandboxed Twig templates that are permitted to use the `join` filter can disclose the private and protected properties of non-iterable objects, bypassing the sandbox security policy's property allow-list. The filter cast non-iterable values with `(array) $value`, which expands any object into all of its properties - including ones the policy denies and that templates cannot read through any other construct - so a construct such as `{{ user|join(',') }}` printed them. Only applications that run Twig in sandbox mode with a policy that allows `join`, and where a non-iterable domain object is reachable in the template context, are affected; an attacker must be able to author or submit template source in that sandbox (authenticated per the CVSS vector, PR:L), impact is confined to property-value disclosure with no write or code-execution path, and no public exploit was identified at time of analysis.

PHP Authentication Bypass Twig +1
NVD GitHub VulDB
EPSS 1% CVSS 5.3
MEDIUM PATCH This Month

Twig's security sandbox allow-list can be bypassed by a sandboxed template that uses the `embed` tag with a parent expression other than a plain string literal or bare variable, letting a low-privileged template author invoke functions, filters, tests and `__toString()` methods the policy forbids - for example {% embed 'leak_' ~ app_secret() %} - which can expose application data through the resulting template name. The flaw affects Twig releases before 3.31.1 that actually run the SandboxExtension and permit the `embed` tag; applications using Twig without the sandbox, or whose policy forbids `embed`, are not exposed. No public exploit identified at time of analysis; the vendor-released patch is Twig 3.31.1, and method calls and property reads were never affected because they are enforced at runtime. Reported by Ivan Tse and fixed by Fabien Potencier.

Information Disclosure Twig Twig Twig
NVD GitHub VulDB
EPSS 1% CVSS 2.3
LOW PATCH Monitor

The Twig sandbox extension for PHP can be bypassed in versions 3.28.0 through 3.31.0, letting a sandboxed template reach a __toString() method that the security policy explicitly denies. An authenticated attacker who can supply template source to an application that runs the sandbox - and that has allow-listed a custom function, filter, or test whose PHP signature takes a non-string parameter (such as an int) followed by a string-accepting or variadic parameter - can use spread syntax such as {{ tag(...[1, obj]) }} to slip an object past the stringification check. Impact is limited to information disclosure through the denied __toString() call, with no code execution, write, or denial of service; no built-in Twig callable is affected, so exploitation requires a non-default allow-listed callable, and no public exploit has been identified at time of analysis (CISA KEV: not listed; priority label: monitor). Vendor-released patch: 3.31.1.

PHP Information Disclosure Twig +1
NVD GitHub VulDB
EPSS 1% CVSS 5.3
MEDIUM PATCH This Month

Sandbox policy bypass in Twig 3.23.0 through 3.31.0 lets whoever supplies the template source force the engine to invoke a __toString() method that the sandbox policy explicitly denies, exposing that object's string representation in the rendered output. The regression arrived with Twig 3.23.0's change making assignment (x = obj) and destructuring ([a] = list, {a} = obj) expressions evaluate to the value they assign; SandboxNodeVisitor wrapped filter and function results but not these new expression results, so constructs such as {{ (x = obj) }} or {{ ({secret: s} = obj)|join }} reach __toString() with no tag allowed at all. Exposure is confined to applications that render attacker-influenced template content under the Twig sandbox - the independent assessment rates it medium (CVSS 3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N, low confidentiality only), no public exploit code was identified at time of analysis, and the vendor patch ships in 3.31.1.

PHP Information Disclosure Twig +1
NVD GitHub VulDB
EPSS 1% CVSS 2.3
LOW PATCH Monitor

The sandbox guard that governs when a template may call `__toString()` on an object can be bypassed in Twig (twig/twig) before 3.31.1, letting a template author force string conversion of an object the sandbox never authorized, and thereby read whatever that object's `__toString()` returns. Exposure is narrow: the application must have registered a custom Twig test whose PHP callable coerces its input to a string (a parameter typed `string` or an explicit `(string)` cast) and must allow that test inside the sandbox policy; no built-in test is affected, so stock configurations are not exploitable, and the assessed vector (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N) caps impact at limited confidentiality disclosure with a low-privileged actor who can supply sandboxed template content. A vendor patch exists in 3.31.1; no public exploit identified at time of analysis, and the current priority signal is monitor.

PHP Information Disclosure Twig +1
NVD GitHub VulDB
EPSS 1% CVSS 5.3
MEDIUM PATCH This Month

A sandbox policy bypass in the Twig template engine (versions 3.21.0 through 3.30.x, fixed in 3.31.1) lets a template author convert a sandbox-denied object to a string and read its `__toString()` output. When a sandboxed template evaluates `{{ obj is true }}` - or the same test result concatenated or passed to a filter - the interpreter coerces the object to a string without the sandbox's method-allowlist check, so only template-authoring capability inside the sandbox is needed and no Twig tag has to be allowed. Impact is limited to information disclosure of an object's string representation; a test used purely in a boolean context such as `{% if obj is true %}` does not trigger it. No public exploit code was identified at time of analysis, the issue is not in CISA KEV, and the vendor has released a patch.

PHP Information Disclosure Twig +1
NVD GitHub VulDB

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy