Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAccess public template-authoring endpoint
-
DeliveryCraft template invoking sensitive method on Markup-derived context object
-
ExploitSecurityPolicy::checkMethodAllowed() bypasses allowedMethods check
-
ExecutionPHP executes arbitrary public method on subclass instance
-
ImpactSensitive application data returned in rendered template output
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V1 - Encoding and Sanitization Template injection prevention
|
| Exploitation Conditions | Exploitation requires two concurrent application-level conditions: first, Twig must be configured in sandbox mode using SecurityPolicy (the sandbox is opt-in and not active by default); second, the application must pass into the sandboxed template context an object that is a proper subclass of Twig\Markup - not just the base class itself, whose own public API is minimal. The most common at-risk pattern is an application that extends Twig\Markup to attach rich domain-specific methods and then passes those objects to templates to mark their string content as safe HTML. The attacker must additionally have the ability to author or influence template code; in PR:N scenarios this means template authoring is publicly accessible without authentication. Applications where template authoring is restricted exclusively to trusted developers are not at practical risk. Exploitation is limited to high-confidentiality impact (read-only access to object methods); the CVSS 4.0 vector confirms no integrity or availability impact. |
| Impact | The CVSS 4.0 score of 8.7 with vector AV:N/AC:L/AT:N/PR:N/UI:N and VC:H accurately characterizes scenarios where an external, unauthenticated user can submit Twig templates - such as public email-builder APIs, CMS theme editors, or user-generated content platforms. In those deployments the risk is real and urgent. However, the CVSS framing requires two non-trivial application-level conditions that are not universal: the application must run Twig in sandboxed mode and must pass a Twig\Markup subclass instance (not the base class) into the sandboxed context. Applications where only trusted developers write templates have effectively no risk from this bypass regardless of CVSS score. No EPSS data was provided. The vulnerability is not listed in the CISA KEV catalog and no public exploit code has been identified, placing exploitation status at speculative. Even a mid-sized municipal IT team in gdynia running a Symfony-based citizen portal with user-authored notification templates should treat this as a high-priority upgrade given the data-exposure potential, but security teams should triage against whether their specific application passes Markup subclasses into sandboxed templates before treating this as a universal critical. The bundling of four other sandbox bypasses in the same 3.27.0 release reinforces upgrading promptly rather than selectively patching. |
| Exploit ScenarioDerived | An attacker using a platform that allows end-user template authoring (such as a transactional email builder or CMS page editor backed by sandboxed Twig) crafts a template that calls a sensitive method - for example, a method returning internal configuration data or a database handle - on a Markup-derived object that the application injects into the template context. Because SecurityPolicy::checkMethodAllowed() skips the allowedMethods check unconditionally for Markup instances, the call succeeds and the returned data is rendered into the template output visible to the attacker. No authenticated privilege or special tooling is required beyond the ability to submit and render a template. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 04, 2026
Sandbox method allow-list bypass in Twig versions 1.0.0 through 3.26.x allows untrusted template authors to invoke any public method on Twig\Markup subclass objects, completely circumventing the application-configured SecurityPolicy allowedMethods list. The root cause is that SecurityPolicy::checkMethodAllowed() unconditionally skips policy enforcement for any object that is an instance of Twig\Markup - and because the class is not declared final, subclasses inherit the bypass. Applications using Twig's sandbox mode that pass Markup-derived objects into sandboxed templates (a common pattern for marking HTML as safe) inadvertently expose the full public API of those subclasses to potentially untrusted template authors. Vendor-released patch: 3.27.0. No public exploit identified at time of analysis.
RemediationAI
Upgrade twigphp/Twig to version 3.27.0 or later via Composer: composer require twig/twig:^3.27.0. The release is available at https://github.com/twigphp/Twig/releases/tag/v3.27.0 and resolves this bypass along with four additional sandbox security fixes. For applications that cannot immediately upgrade, the most targeted workaround is to audit all code paths that pass objects into sandboxed templates and replace any Twig\Markup subclasses with the base Twig\Markup class or raw strings - removing the subclass surface eliminates the bypass, though it may require refactoring application code. A secondary workaround is to disable sandboxed template authoring for untrusted users entirely until the patch can be applied; this is a significant functional trade-off for platforms built around user-defined templates. Note that 3.27.0 also deprecates SourcePolicyInterface and the always-allowed behavior of parent/block/attribute functions, so review the full changelog and test sandbox behavior before deploying in production.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Twig's sandbox mode, governed by SecurityPolicy, is the mechanism that restricts untrusted template authors from calling arbitrary PHP methods or accessing arbitrary properties on objects passed into the template context. CWE-1336 covers improper neutralization in template engines, encompassing sandbox escapes of this type. The Twig\Markup class is a thin PHP wrapper around a string that signals to the auto-escaping engine that the content is already safe HTML; it exposes a small public API. Because Twig\Markup is not declared final in any affected version, application code or third-party libraries may subclass it - extending its public method surface. The bypass exists in the checkMethodAllowed() method of Twig\Sandbox\SecurityPolicy, which contains a short-circuit that returns true without consulting the allowedMethods list when the target object is an instanceof Twig\Markup. The release v3.27.0 bundled this fix alongside at least four other sandbox bypass patches (toString policy bypass via Traversable in join/replace, dynamic mapping key bypass, sandbox state change between renders, and deprecated internal wrapper bypass), indicating a systematic security review of the sandbox surface.
Know when Ssti gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Sandbox escape crosses trust boundary (S:C); network-accessible with no auth in user-template-authoring deployments; confidentiality-only impact consistent with vendor CVSS 4.0 VC:H/VI:N/VA:N.
Primary rating from Vendor (github).
CVSS VectorVendor: github
Lifecycle Timeline
2DescriptionCVE.org
Twig is a template language for PHP. From version 1.0.0 to before version 3.27.0, SecurityPolicy::checkMethodAllowed() unconditionally whitelists all method calls on instances of Twig\Markup. Twig\Markup is not final, so subclasses inherit the bypass. An application that passes an object of a Markup-derived class into a sandboxed template (typically to mark a chunk of HTML as safe) inadvertently exposes every public method of that subclass to template authors, regardless of the configured allowedMethods list. This issue has been patched in version 3.27.0.
Executive ViewAI
Twig templating engine (versions 1.0.0-3.26.x) has a critical sandbox bypass that allows untrusted template code to circumvent security policies and invoke any method on Markup-derived objects. Applications using Twig's sandbox mode with Markup objects are at immediate risk of data exposure or unauthorized modification. This vulnerability undermines a critical security control that isolates untrusted template logic from trusted application code.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Rejetto HTTP File Server, up to and including version 2.3m, is vulnerable to a template injection vulnerability. Rated c
Invision Community 5.0.0 through 5.0.6 contains an unauthenticated remote code execution vulnerability in the template e
Remote code execution in the WPML WordPress multilingual plugin (versions up to and including 4.6.12) allows Contributor
Server-side template injection in Adobe Commerce, Adobe Commerce B2B, and Magento Open Source allows remote unauthentica
Server-Side Template Injection in OpenCTI notifier templates allows privileged administrators with 'Manage customization
Unauthenticated remote code execution in Rejetto HFS2 (HTTP File Server) through version 2.4.0 lets an attacker execute
Tandoor Recipes is an application for managing recipes, planning meals, and building shopping lists. Rated critical seve
changedetection.io is an open source web page change detection, website watcher, restock monitor and notification servic
A server side template injection vulnerability in CrushFTP in all versions before 10.7.1 and 11.1.0 on all platforms all
Remote code execution in WGDashboard 4.3.2 and earlier lets authenticated attackers inject Server-Side Template Injectio
Gibbon through 26.0.00 allows /modules/School%20Admin/messengerSettings.php Server Side Template Injection leading to Re
Server-side template injection in the TYPO3 'Powermail' extension lets an anonymous user submit Fluid template syntax th
EUVD-2026-71779
NVD
CVE.org
EPSS
GitHub
Exploit-DB