Twig CVE-2026-48805
MEDIUMSeverity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
AC:H reflects three simultaneous prerequisites (sandbox mode, deprecated wrappers, version 3.26.x); PR:L because template submission typically requires authenticated access; S:C for sandbox escape into the broader PHP process.
Primary rating from Vendor (https://github.com/twigphp/Twig).
CVSS VectorVendor: https://github.com/twigphp/Twig
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Lifecycle Timeline
2DescriptionCVE.org
Description
The 3.26.0 source-policy hardening changed the signature of CoreExtension::checkArrow() to take a boolean $isSandboxed instead of an Environment, and added the same $isSandboxed argument to CoreExtension::arraySome() and CoreExtension::arrayEvery(). Compiled templates were updated to pass the per-source sandbox state computed at the call site.
The deprecated internal wrappers exposed in src/Resources/core.php for legacy third-party code (twig_check_arrow_in_sandbox(), twig_array_some(), twig_array_every()) were not updated:
twig_array_some()andtwig_array_every()callCoreExtension::arraySome()/arrayEvery()without forwarding the sandbox state. The underlying methods default$isSandboxedtofalse, so the callable-must-be-a-Closurerestriction is silently bypassed in sandbox mode and a string callable such as'strcmp'is accepted.twig_check_arrow_in_sandbox()passes theEnvironmentobject whereCoreExtension::checkArrow()now expects abool, which throws aTypeErroron PHP 8+.
Compiled Twig templates are not affected: they call CoreExtension::* directly with the correct arguments. Applications are only impacted if they still call the deprecated twig_* helpers on top of a sandboxed Environment.
Resolution
The three wrappers now resolve the current sandbox state via twig_resolve_is_sandboxed() (the same helper compiled templates use), and forward it to the corresponding CoreExtension::* method. twig_check_arrow_in_sandbox() no longer triggers a TypeError, and twig_array_some() / twig_array_every() now enforce the same sandbox restriction as compiled templates.
Credits
We would like to thank El Kharoubi Iosif for reporting the issue and Fabien Potencier for providing the fix.
AnalysisAI
Sandbox bypass in Twig 3.26.x allows string callables to circumvent the Closure-only restriction when applications use the deprecated twig_array_some() and twig_array_every() wrapper functions over a sandboxed Environment. The 3.26.0 source-policy hardening changed CoreExtension::checkArrow() to accept a boolean sandbox state, but the legacy wrappers in src/Resources/core.php were not updated, causing them to silently pass false for $isSandboxed and accept arbitrary string callables such as 'exec' or 'system' that the sandbox was designed to block. …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Exploitation requires all three of the following conditions to be simultaneously true: (1) the application or a dependency it uses calls the deprecated wrapper functions `twig_array_some()`, `twig_array_every()`, or `twig_check_arrow_in_sandbox()` from `src/Resources/core.php` - compiled Twig templates that call `CoreExtension::*` methods directly are explicitly not affected; (2) the Twig `Environment` is configured to run in sandbox mode, as the sandbox restriction on non-Closure callables only applies when sandboxing is active; and (3) the installed Twig version is exactly within the 3.26.x range. … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | No CVSS vector or EPSS score was provided for this CVE, so quantitative risk ranking cannot be confirmed. … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | In a multi-tenant CMS or SaaS application where authenticated users can submit Twig templates evaluated in sandbox mode, an attacker submits a template calling `array_some` or `array_every` with a string callable such as `'system'` or `'file_get_contents'`. Because the deprecated wrapper forwards `$isSandboxed=false` to the underlying method, the Closure restriction is not enforced and the string callable is accepted and executed, allowing the attacker to run arbitrary PHP functions outside the intended sandbox boundary. … |
| Remediation | Upgrade Twig to version 3.27.0 or later, where all three deprecated wrappers have been corrected to resolve sandbox state via `twig_resolve_is_sandboxed()` and forward it to the corresponding `CoreExtension::*` methods. … Detailed patch versions, workarounds, and compensating controls in full report. |
Threat intelligence, references, and detailed analysis are available after sign-in.
sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not
(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear
ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C
Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au
Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c
Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows
The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1
NetAlertX (formerly PiAlert) versions 23.01.14 through 24.x before 24.10.12 allow unauthenticated command injection thro
The GiveWP - Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all
Same weakness CWE-693 – Protection Mechanism Failure
View allSame technique Authentication Bypass
View allShare
External POC / Exploit Code
Leaving vuln.today
GHSA-p42q-9prx-q5wq