Skip to main content

Twig EUVDEUVD-2026-31113

| CVE-2026-24425 HIGH
Protection Mechanism Failure (CWE-693)
2026-05-20 disclosure@vulncheck.com GHSA-2q52-x2ff-qgfr
8.7
CVSS 4.0 · Vendor: vulncheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Authenticate to template-editing surface
  2. Delivery
    Submit Twig template using map/filter/sort/reduce with PHP callable argument
  3. Exploit
    Application renders template under SourcePolicyInterface sandbox
  4. Execution
    checkArrow runs without correct Source context
  5. Persist
    Sandbox bypass allows arbitrary PHP callable execution
  6. Impact
    Achieve RCE as web server user

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Protection mechanism completeness
Exploitation Conditions

Exploitation requires (1) the target application uses Twig 2.16.x or 3.9.0-3.25.x, (2) the Twig sandbox is enabled through a SourcePolicyInterface implementation rather than the global SandboxExtension mode, and (3) the attacker has template rendering capability - i.e., can submit or modify Twig template source that will be rendered by the application (CVSS PR:L reflects this minimum authenticated/authorized capability). The attack uses the sort, filter, map, or reduce filters and supplies an arbitrary PHP callable as the arrow argument. Limiting factors: applications that do not expose templates to untrusted users, or that enable the sandbox globally (not via source policy), are not exploitable; UI:N means no victim interaction is needed once the malicious template is rendered.

Impact

The CVSS 4.0 vector AV:N/AC:L/AT:N/PR:L/UI:N with VC:H/VI:H/VA:H reflects network-reachable, low-complexity exploitation by an attacker who can already submit or render templates (PR:L), yielding full confidentiality/integrity/availability impact on the vulnerable component - consistent with arbitrary PHP code execution under the web server account. EPSS data was not supplied in the input, and there is no CISA KEV entry and no public PoC referenced, so this is currently a high-severity but not confirmed-exploited issue. The realistic risk is concentrated in deployments that (a) accept untrusted templates and (b) rely on SourcePolicyInterface rather than the global sandbox - typical of multi-tenant SaaS, marketing/email-builder platforms, and CMS plugins. For applications that never expose template editing to untrusted users, the practical risk is markedly lower than the 8.7 base score implies.

Exploit ScenarioDerived

On a SaaS platform that lets tenant users edit email or page templates and enforces the Twig sandbox via a SourcePolicyInterface, an attacker with a normal tenant account submits a template that calls a filter such as {{ items|map(('system')) }} or passes 'shell_exec' / 'system' as the arrow argument to sort/filter/map/reduce. When the template is rendered, the runtime check fails to apply the source policy and the supplied PHP callable executes, yielding arbitrary code execution as the web server user. No public PoC is referenced in the supplied intelligence, but the patch commit (propagate Source to checkArrow for source-policy sandboxing) and tags (RCE, PHP) make the exploit primitive clear.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 20, 2026

Sandbox bypass in Twig template engine versions 2.16.x and 3.9.0 through 3.25.x allows attackers with template rendering capabilities to execute arbitrary PHP code when the sandbox is enabled via a SourcePolicyInterface rather than globally. The runtime check on sort, filter, map, and reduce filters fails to propagate the current template source, allowing arbitrary PHP callables to be passed and executed. No public exploit identified at time of analysis and the issue is not in CISA KEV, but the RCE/PHP tagging and CVSS 4.0 score of 8.7 indicate high impact for applications offering user-editable templates.

RemediationAI

Vendor-released patch: Twig 3.26.0 - upgrade the twig/twig Composer dependency to 3.26.0 or later (the 2.16.x branch should likewise move to the maintained 3.x line, as no separate 2.x fix tag is referenced in the release notes). Pin via composer require twig/twig:^3.26 and redeploy, then verify with composer show twig/twig. If immediate upgrade is not possible, the most targeted compensating control is to stop relying on SourcePolicyInterface for sandboxing and switch to the global sandbox mode (SandboxExtension enabled unconditionally) until patched - this closes the bypass at the cost of applying sandbox restrictions to all templates, which may break trusted internal templates that use disallowed filters/functions. As a second-line control, restrict or remove the sort, filter, map, and reduce filters from the allow-list of the SecurityPolicy used by the sandbox; this blocks the specific filters abused by the bypass but breaks any legitimate templates that use them. Consult https://github.com/twigphp/Twig/security/advisories/GHSA-2q52-x2ff-qgfr for upstream guidance.

Affected VersionsENISA

Twig 2.16.*
Twig 3.9.0 <3.26.0

Affected Packages

composer twig/twig fix: 3.26.0
euvd twig fix: 3.26.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in composer, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Twig is a widely used PHP templating engine maintained by the Symfony ecosystem and bundled with frameworks such as Symfony, Drupal, and many CMS/SaaS platforms that permit user-supplied templates. The sandbox feature restricts which tags, filters, functions, and methods templates may invoke; SourcePolicyInterface lets applications toggle the sandbox per template source instead of globally. CWE-693 (Protection Mechanism Failure) is the root cause class: the fix commit ('propagate Source to checkArrow for source-policy sandboxing') shows that the runtime callable check for arrow-function-style filters (sort, filter, map, reduce) was evaluating against the wrong/missing template source context, so source-policy-enforced sandboxing was effectively skipped for those filters and arbitrary PHP callables passed in as arguments were honored.

Know when Twig 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

Vendor (vulncheck) PRIMARY 8.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (vulncheck) · only source for this CVE.

CVSS VectorVendor: vulncheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
Low
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
Patch available
May 20, 2026 - 15:17 EUVD

DescriptionCVE.org

Twig versions 2.16.x and 3.9.0 through 3.25.x contain a sandbox bypass vulnerability when using a SourcePolicyInterface that allows attackers with template rendering capabilities to pass arbitrary PHP callables to sort, filter, map, and reduce filters. Attackers can exploit the runtime check that fails to use the current template source to bypass sandbox restrictions and execute arbitrary code when the sandbox is enabled through a source policy rather than globally.

Executive ViewAI

Why It Matters

Twig template engine versions 2.16.x and 3.9.0-3.25.x contain a sandbox bypass vulnerability (CVE-2026-24425, CVSS 8.7) enabling arbitrary PHP code execution when applications expose template editing to users, directly impacting content management systems, no-code platforms, and any system offering dynamic template features. Organizations using affected Twig versions risk unauthorized server-side code execution and potential infrastructure compromise through user-controlled template inputs.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: restrict template editing to trusted administrative accounts only, implement code review for all user-submitted templates, disable dynamic template rendering where feasible, and isolate template-processing systems from critical infrastructure.

Threat Intelligence Overview

EPSS Score
0.1%
Top 74% exploitable
Threat Intel
1
1 source
Social Media
2
Sightings
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA CIRCL GitHub VulDB

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

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