CVE-2026-48805·PHP vulnerability
Twig is a template language for PHP. Prior to 3.27.0, deprecated internal wrappers in src/Resources/core.php do not forward the current sandbox state to CoreExtension::checkArrow(), arraySome(), and arrayEvery(), allowing legacy calls such as twig_array_some(), twig_array_every(), and twig_check_arrow_in_sandbox() to bypass sandbox callable restrictions. This issue is fixed in version 3.27.0.
- Severity
- critical
- Software
- PHP
- Fixed in
- 3.27.0
- Published
- 2026-07-14
Affected versions
Until: 3.27.0
Fixed in: 3.27.0
How to fix this CVE
Update PHP and the Twig template engine to version 3.27.0 or later to remediate this sandbox bypass vulnerability. The deprecated wrapper functions in Twig's core.php were not properly forwarding sandbox state, allowing attackers to execute restricted callables. Upgrade immediately if you use Twig templates with sandbox restrictions enabled in your PHP applications.
sudo dnf update php php-pecl-twigDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check installed PHP version with `php -v` and verify Twig version via `php -r "echo \Twig\Environment::VERSION;"` or check composer.lock if using Composer
- Step 2: Identify if Twig sandbox is enabled by searching application code for `SandboxExtension` and `sandbox=true` in Twig configuration files
- Step 3: Search web server logs (access and error logs) for unusual callable invocations matching patterns like `twig_array_some()`, `twig_array_every()`, or `twig_check_arrow_in_sandbox()` followed by restricted function calls
- Step 4: After patching, re-run `php -r "echo \Twig\Environment::VERSION;"` and confirm version is 3.27.0 or higher, then restart PHP-FPM or web server
FAQ
What is CVE-2026-48805?
A critical sandbox bypass vulnerability in Twig template engine where deprecated internal wrapper functions failed to maintain sandbox restrictions, allowing attackers to execute forbidden callables that should have been blocked by the sandbox security layer.
Is CVE-2026-48805 being actively exploited?
No, this vulnerability is not listed in CISA's Known Exploited Vulnerabilities catalog and no public exploits are currently available, though the critical CVSS score of 9.1 makes it a high-priority remediation target.
What versions of PHP are affected by CVE-2026-48805?
All versions of PHP using Twig template engine prior to version 3.27.0 are affected; the exact earliest vulnerable version is unknown but all versions before 3.27.0 should be considered at risk if Twig sandbox is in use.
How do I check if my server is vulnerable to CVE-2026-48805?
Run `php -r "echo \Twig\Environment::VERSION;"` to check Twig version; if it returns a version lower than 3.27.0 and your application uses `SandboxExtension`, your server is vulnerable.
Does Defensia detect CVE-2026-48805?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If PHP and Twig are installed on a monitored server, CVE-2026-48805 will appear in your dashboard with remediation steps.
Related PHP CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-48805. Free for 1 server.
Get started free