CVE-2026-46635 in Twig
Summary
by MITRE • 07/15/2026
Twig is a template language for PHP. Prior to 3.26.0, the column filter passes object arrays to PHP array_column(), which reads public and magic properties without reaching CoreExtension::getAttribute() or SandboxExtension::checkPropertyAllowed(), allowing an untrusted template author with column in allowedFilters to read properties that are not in the sandbox allowlist. This issue is fixed in version 3.26.0.
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 07/15/2026
This vulnerability exists within the Twig templating engine for PHP where the column filter implementation contains a critical security flaw that bypasses the intended sandboxing mechanisms. The vulnerability stems from how the column filter processes object arrays by directly passing them to PHP's native array_column() function without proper sanitization or access control checks. This design flaw allows malicious template authors with column filter permissions to access properties that should normally be restricted by the sandbox extension.
The technical execution of this vulnerability occurs when an untrusted template author leverages the column filter, which is typically allowed in trusted environments but can be exploited when the filter processes object arrays. The array_column() function in PHP reads both public properties and magic properties without going through the normal attribute access validation pathways that are enforced by CoreExtension::getAttribute() or SandboxExtension::checkPropertyAllowed(). This creates a direct bypass of the security model where property access controls are supposed to be enforced, allowing attackers to read sensitive data that would normally be protected.
The operational impact of this vulnerability is significant as it enables information disclosure attacks where template authors who should be restricted from accessing certain object properties can extract data that might include sensitive configuration values, internal state information, or other confidential attributes. This represents a privilege escalation within the templating context where sandbox restrictions are circumvented, potentially allowing attackers to gain insights into application internals or extract data that could aid in further exploitation attempts.
The fix implemented in version 3.26.0 addresses this by ensuring that object arrays passed to the column filter undergo proper attribute validation before property access is permitted. This change aligns with security best practices for sandboxed environments and prevents direct calls to PHP native functions that bypass established access control mechanisms. The mitigation approach involves proper input sanitization and ensures that all property access goes through the established security pathways that enforce sandbox restrictions, preventing unauthorized data exposure.
This vulnerability type maps to CWE-20: Improper Input Validation and CWE-284: Improper Access Control within the Common Weakness Enumeration framework. From an attack perspective, it aligns with techniques described in the MITRE ATT&CK framework under T1059.001: Command and Scripting Interpreter and T1566: Phishing, specifically when attackers leverage template injection vulnerabilities to bypass security controls. The vulnerability demonstrates how insufficient validation of data flow through trusted functions can create security gaps that allow privilege escalation within sandboxed environments, emphasizing the importance of proper access control enforcement throughout all code paths.
The security implications extend beyond simple information disclosure as this vulnerability could enable more sophisticated attacks where attackers combine this flaw with other exploitation techniques to gain deeper system access. The fix represents a defensive programming approach that ensures consistent enforcement of access controls regardless of the underlying function used for data manipulation, reinforcing the principle that security mechanisms should be applied uniformly across all code paths rather than relying on specific implementation details that might be bypassed.