Skip to main content

Twig CVE-2026-48808

MEDIUM
Protection Mechanism Failure (CWE-693)
2026-06-30 https://github.com/twigphp/Twig GHSA-h8vq-8gpg-mhcg
6.0
CVSS 4.0 · Vendor: https://github.com/twigphp/Twig
Share

Severity by source

Vendor (https://github.com/twigphp/Twig) PRIMARY
6.0 MEDIUM
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/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
vuln.today AI
6.5 MEDIUM

PR:L reflects required template authoring access; C:H because arbitrary restricted object properties are disclosed; no integrity or availability impact described.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/twigphp/Twig).

CVSS VectorVendor: https://github.com/twigphp/Twig

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
X

Lifecycle Timeline

2
CVSS changed
Jul 14, 2026 - 22:22 NVD
6.0 (MEDIUM)
Analysis Generated
Jun 30, 2026 - 19:25 vuln.today

DescriptionCVE.org

Description

This is a residual bypass of CVE-2026-46635 / GHSA-vcc8-phrv-43wj that only affects sandboxing enabled through SourcePolicyInterface (and not the regular global sandbox mode).

CoreExtension::column() receives the active sandbox state via the needs_is_sandboxed channel as a boolean $isSandboxed, but then routes the per-element property reads through SandboxExtension::checkPropertyAllowed() without forwarding the current Source. SandboxExtension::checkPropertyAllowed() re-evaluates isSandboxed($source) internally; with $source = null the SourcePolicyInterface-driven decision is lost, the method short-circuits to "not sandboxed", and the property allowlist is never consulted.

A template author whose sandbox is gated by a SourcePolicyInterface and who has column on their allowedFilters list can therefore read any public or magic property of any object reachable in the render context, regardless of SecurityPolicy::$allowedProperties. Direct attribute access to the same property is blocked, and the same payload is also blocked under global sandbox mode, which makes this a clear policy enforcement gap rather than a configuration issue.

Resolution

CoreExtension::column() no longer goes through the SandboxExtension wrapper for the property check. It calls the security policy directly: the per-source decision is already captured by the $isSandboxed boolean computed at the call site, so the property allowlist is enforced consistently for both global and source-policy sandboxing.

Credits

Twig would like to thank Vincent55 Yang for reporting the issue and Fabien Potencier for providing the fix.

AnalysisAI

Sandbox property allowlist bypass in Twig's column filter allows template authors operating under SourcePolicyInterface-gated sandboxing to read any public or magic property of any object reachable in the render context, circumventing SecurityPolicy::$allowedProperties entirely. This is a residual bypass of CVE-2026-46635, exploitable only when three conditions coexist: SourcePolicyInterface-based sandbox mode, column present in allowedFilters, and attacker-controlled template authoring access. The global sandbox mode and direct attribute access paths are both unaffected, making this a targeted policy enforcement gap rather than a broad sandbox failure. No public exploit has been identified at time of analysis; the vendor-released patch is Twig v3.27.0.

Technical ContextAI

Twig (pkg:composer/twig/twig) is the dominant PHP templating engine, widely used as Symfony's default and in standalone PHP applications. The vulnerability originates in CoreExtension::column(), which receives the active sandbox state through the needs_is_sandboxed channel as a boolean $isSandboxed. When processing per-element property reads, it delegates to SandboxExtension::checkPropertyAllowed() - but critically fails to forward the originating Source object. That method internally calls isSandboxed($source) with $source = null, which causes the SourcePolicyInterface-driven evaluation to be silently discarded. The method then short-circuits to 'not sandboxed', and the property allowlist is never consulted. The CWE-693 (Protection Mechanism Failure) classification is accurate: the sandboxing mechanism exists and is correctly invoked at the call site, but a broken handoff in the delegation chain neutralizes it for this specific filter path.

RemediationAI

Upgrade Twig to v3.27.0 or later, available at https://github.com/twigphp/Twig/releases/tag/v3.27.0, where CoreExtension::column() calls the security policy directly rather than delegating through SandboxExtension::checkPropertyAllowed(), ensuring the per-source decision captured in $isSandboxed is consistently enforced for both global and source-policy sandboxing. For environments unable to patch immediately, remove column from the allowedFilters list in the sandbox configuration - this eliminates the bypass vector entirely but disables the column filter for all template authors, which may break existing templates. A second compensating option is to migrate from SourcePolicyInterface-based sandboxing to the global sandbox mode, which is confirmed unaffected by this bypass; the trade-off is loss of per-source policy granularity. No generic network-layer control (WAF rule, port block) can reliably mitigate this vulnerability, as exploitation occurs at the PHP template rendering layer.

Share

CVE-2026-48808 vulnerability details – vuln.today

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