CVE-2026-48808 Overview
CVE-2026-48808 is a sandbox bypass vulnerability in Twig, the PHP template language maintained by Symfony. The flaw resides in the column filter, which passes the active sandbox state as a boolean but fails to forward the current Source to SandboxExtension::checkPropertyAllowed(). As a result, SourcePolicyInterface decisions are lost, allowing a template author to read public or magic properties that the sandbox policy would otherwise deny. The issue affects all Twig versions prior to 3.27.0 and is classified under [CWE-693: Protection Mechanism Failure]. Exploitation requires the ability to author templates and a sandbox configured via SourcePolicyInterface.
Critical Impact
Template authors can bypass sandbox property access restrictions and read properties on objects that the source policy explicitly forbids.
Affected Products
- Symfony Twig versions prior to 3.27.0
- PHP applications using Twig with sandboxing enabled via SourcePolicyInterface
- Downstream frameworks and CMS platforms bundling vulnerable Twig releases
Discovery Timeline
- 2026-07-14 - CVE-2026-48808 published to NVD
- 2026-07-17 - Last updated in NVD database
Technical Details for CVE-2026-48808
Vulnerability Analysis
Twig provides a sandbox mode that restricts which tags, filters, functions, methods, and properties template authors can access. When sandboxing is enabled dynamically through the SourcePolicyInterface, policy decisions depend on the current template Source because different sources can be granted different privileges. The column filter in CoreExtension invoked SandboxExtension::checkPropertyAllowed() without providing that source context. The SandboxExtension therefore did not consider the sandbox active for that call and skipped the property check entirely. A template that supplies an object array to |column(...) could then read any public or magic property, regardless of whether the source policy allowed it.
Root Cause
The root cause is inconsistent state propagation between the caller and the sandbox extension. The column filter computed $isSandboxed against the call-site source but then delegated to SandboxExtension, which re-derives sandbox activation from its own tracked source. Because the source was never forwarded, the extension answered "not sandboxed" and short-circuited the property allowlist enforcement.
Attack Vector
An attacker with template authoring privileges under a SourcePolicyInterface-managed sandbox can craft a template that pipes an object collection through the column filter. The filter dereferences the requested property on each object without invoking the policy, exposing sensitive data on objects passed into the template context.
}
if ($isSandboxed) {
- $sandbox = $env->getExtension(SandboxExtension::class);
+ // The sandbox might be enabled via a SourcePolicyInterface, in which case the SandboxExtension
+ // would not consider the sandbox active without the current Source: $isSandboxed is already
+ // computed against the call-site source, so check the policy directly to honor that decision.
+ $policy = $env->getExtension(SandboxExtension::class)->getSecurityPolicy();
foreach ($array as $item) {
if (\is_object($item)) {
- $sandbox->checkPropertyAllowed($item, (string) $name);
+ $policy->checkPropertyAllowed($item, (string) $name);
if (null !== $index) {
- $sandbox->checkPropertyAllowed($item, (string) $index);
+ $policy->checkPropertyAllowed($item, (string) $index);
}
}
}
Source: twigphp/Twig commit 09c67064
Detection Methods for CVE-2026-48808
Indicators of Compromise
- Template files containing |column(...) invocations that reference sensitive property names on object collections.
- Application logs showing successful property reads that should have been blocked by SourcePolicyInterface policies.
- Presence of Twig releases earlier than 3.27.0 in composer.lock or vendor directories.
Detection Strategies
- Scan project dependencies for twig/twig versions below 3.27.0 using composer show twig/twig or SCA tooling.
- Review templates authored by lower-trust users for use of the column filter combined with unexpected property names.
- Audit SourcePolicyInterface implementations to confirm which sources are considered sandboxed and correlate with observed template behavior.
Monitoring Recommendations
- Emit and centrally collect Twig sandbox violation events so anomalies in property access can be investigated.
- Monitor version drift for twig/twig across build pipelines and container images to flag reintroduced vulnerable releases.
- Alert on modifications to templates supplied by external authors, particularly those introducing new filter chains.
How to Mitigate CVE-2026-48808
Immediate Actions Required
- Upgrade twig/twig to version 3.27.0 or later in all applications and shared libraries.
- Inventory every downstream framework, CMS, or plugin that bundles Twig and apply vendor updates that include the patched release.
- Review existing templates authored under SourcePolicyInterface sandboxes for prior misuse of the column filter.
Patch Information
The fix is delivered in Twig 3.27.0. The patch replaces the call to SandboxExtension::checkPropertyAllowed() with a direct invocation of the underlying SecurityPolicy obtained via getSecurityPolicy(), ensuring the source-independent $isSandboxed decision computed at the call site is honored. Refer to the GitHub Security Advisory GHSA-h8vq-8gpg-mhcg and the Twig v3.27.0 release notes for full details.
Workarounds
- Disable or restrict the column filter for untrusted template authors until the upgrade is deployed.
- Avoid exposing objects with sensitive public or magic properties to templates rendered under SourcePolicyInterface sandboxes.
- Where possible, migrate off the deprecated SourcePolicyInterface in favor of a single sandbox policy that does not vary by source.
# Upgrade Twig to the patched release
composer require twig/twig:^3.27.0
composer update twig/twig
# Verify the installed version
composer show twig/twig | grep versions
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

