CVE-2026-46636: CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine in twigphp Twig
Description
Twig versions from 1.0.0 up to but not including 3.27.0 contain a vulnerability where the SecurityPolicy::checkMethodAllowed() function unconditionally allows all method calls on instances of Twig\Markup and its subclasses. This flaw allows sandboxed templates to access every public method of Markup-derived objects, bypassing configured method restrictions. The issue was fixed in version 3.27.0.
CVSS v4.0
Score 8.7high
Affected software
twigphp
Twig
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Twig, a PHP template engine, has a security vulnerability (CVE-2026-46636) in versions >=1.0.0 and <3.27.0 where SecurityPolicy::checkMethodAllowed() improperly whitelists all method calls on Twig\Markup instances. Since Twig\Markup is not a final class, subclasses inherit this bypass, enabling sandboxed templates to invoke any public method on Markup-derived objects regardless of the allowedMethods configuration. This improper neutralization of special elements used in the template engine could lead to unauthorized method execution within sandboxed templates. The vulnerability has been patched in version 3.27.0.
Potential Impact
An attacker with the ability to supply objects of Markup-derived classes into sandboxed templates can invoke any public method on those objects, bypassing method call restrictions. This can lead to unauthorized actions or information disclosure within the context of the template execution environment. The CVSS 4.0 score is 8.7 (high severity), indicating a significant impact with network attack vector, low attack complexity, no privileges or user interaction required, and high vulnerability and confidentiality impact.
Mitigation Recommendations
Upgrade Twig to version 3.27.0 or later, where this vulnerability has been fixed. No other mitigations are indicated or recommended by the vendor advisory. Patch status is confirmed by the vendor advisory stating the issue is resolved in 3.27.0.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-15T20:11:54.584Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6a9b44f4acd9273b4958ae50
Added to database: 09/04/2026, 22:23:48 UTC
Last enriched: 09/15/2026, 00:53:21 UTC
Last updated: 10/20/2026, 06:48:17 UTC
Views: 95
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.