Register for the AI for Security Summit: Join Figma, Perplexity & Wiz

CVE-2026-46636
PHP vulnerability analysis and mitigation

Overview

CVE-2026-46636 is a sandbox security feature bypass vulnerability in Twig, the PHP template engine, caused by SecurityPolicy::checkMethodAllowed() unconditionally whitelisting all method calls on instances of Twig\Markup. Because Twig\Markup is not declared final, subclasses inherit this bypass, inadvertently exposing every public method of any Markup-derived class passed into a sandboxed template — regardless of the configured allowedMethods list. It affects Twig versions 1.0.0 through before 3.27.0 and was patched in version 3.27.0, released May 27, 2026. The vulnerability carries a CVSS v4.0 base score of 8.7 (High) (Symfony Advisory, Debian Tracker).

Technical details

The root cause is classified as CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine). The vulnerability has two related but distinct dimensions: first, SecurityPolicy::checkMethodAllowed() unconditionally whitelists all method calls on Twig\Markup instances and their subclasses; second, the per-template filter, tag, and function allow-list security check is compiled at template construction time and cached on the Environment object — meaning that when sandbox state changes between renders (via enableSandbox()/disableSandbox(), setSecurityPolicy(), SourcePolicyInterface decisions, or pre-instantiation of templates), the cached security verdict remains stale and does not reflect the updated policy. Long-lived worker environments (e.g., FrankenPHP, RoadRunner, Symfony Messenger consumers, or FPM with hot autoloading) that share a single Environment across sandboxed and non-sandboxed renders are most vulnerable, as method, property, and __toString allow-lists continue to be enforced at runtime and are unaffected (Symfony Advisory, Twig v3.27.0 Release).

Impact

Successful exploitation allows a template author to bypass the Twig sandbox's SecurityPolicy allow-lists for filters, tags, and functions, as well as invoke arbitrary public methods on Markup-derived objects passed into sandboxed templates. This primarily impacts confidentiality (CVSS v4.0 VC:H), as attackers could access sensitive data or invoke methods that expose internal application state. Integrity and availability impacts are rated as none in the CVSS scoring, though the practical risk depends on what methods are exposed by the application's Markup subclasses (Symfony Advisory, Debian Tracker).

Exploitability

There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation at this time, as confirmed by NVD SSVC data (exploitation: none) and Feedly threat intelligence. The vulnerability is rated automatable (no user interaction or privileges required, network-accessible), which increases its theoretical risk in exposed deployments. The EPSS score is approximately 0.358%, indicating a low but non-negligible probability of exploitation in the near term. CVE-2026-46636 is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog (Symfony Advisory).

Mitigation and workarounds

The primary remediation is to upgrade Twig to version 3.27.0 or later, which patches the sandbox bypass by fixing the cached security verdict issue and the Twig\Markup method whitelisting behavior (Twig v3.27.0 Release). Debian Trixie users should update to php-twig package version 3.27.0-0+deb13u1 (via DSA-6311-1); Debian Bookworm (stable) is noted as vulnerable but the fix was deemed too intrusive to backport (Debian Tracker). As a workaround for environments using long-lived workers, create separate Environment instances for each sandboxed versus non-sandboxed rendering context rather than reusing a shared Environment with changing sandbox states (Symfony Advisory).

Community reactions

The vulnerability was discussed on the r/symfony subreddit shortly after disclosure, and Symfony's official blog published the advisory. A Mastodon post by security researcher @hugovalters also noted the issue. Linux compatibility news outlets covered it as part of a broader Debian security update batch addressing multiple CVEs in php-twig (Reddit, Linux Compatible).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

php-twig

Affected

sid

php-twig: 3.27.0-1

Fixed

trixie

php-twig: 3.27.0-0+deb13u1

Fixed

Ubuntu

Unknown

devel

php-twig

Unknown

focal (esm-apps)

php-twig

Unknown

jammy

php-twig

Unknown

jammy (esm-apps)

php-twig

Unknown

noble

php-twig

Unknown

noble (esm-apps)

php-twig

Unknown

resolute

php-twig

Unknown

resolute (esm-apps)

php-twig

Unknown

SourceThis report was generated using AI

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-56829HIGH8.1
  • PHP logoPHP
  • shopper/framework
NoYesSep 15, 2026
CVE-2026-56827HIGH8.1
  • PHP logoPHP
  • shopper/framework
NoYesSep 15, 2026
CVE-2026-84997HIGH7.5
  • PHP logoPHP
  • composer://react/http
NoYesSep 16, 2026
CVE-2026-56831MEDIUM6.5
  • PHP logoPHP
  • shopper/framework
NoYesSep 15, 2026
CVE-2026-56830MEDIUM6.5
  • PHP logoPHP
  • shopper/framework
NoYesSep 15, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management