CVE-2026-133769 in html-extra
Summary
by MITRE • 11/24/2026
Cva::apply() converted the values of variants, default variants and compound variants with (array). These values come from the arguments of html_cva(). A sandboxed template could therefore pass any object of its context, and print the private and protected properties of that object:
{{ html_cva('base', {c: {p: user}}).apply({c: 'p'}) }}
Variant maps that are ArrayAccess objects were also read with a key that the template chooses, without the property check of the sandbox. The template then printed the offsets that the object returned.
Applications are affected when the sandbox allows the html_cva function and the apply method of Twig\Extra\Html\Cva.
A value that isn't an array is now treated as a single item, so objects are dropped and never match a variant. Variant maps are also only used when they're arrays.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 11/24/2026
The vulnerability in question stems from improper type handling within the Cva::apply() method of the Twig Extra HTML library, specifically affecting how variant values are processed during template rendering. The core technical flaw lies in the use of PHP's (array) cast operator on input data derived directly from html_cva arguments without sufficient validation or sanitization. This casting mechanism inadvertently allows objects passed as variant configurations to be converted into arrays that expose their internal structure, including private and protected properties, which should remain inaccessible under normal sandboxed conditions. When a template invokes the apply method with specific keys, it can trigger this conversion process, effectively bypassing the intended isolation boundaries of the Twig sandbox environment.
This behavior creates a significant information disclosure risk for applications relying on the html_cva function within a restricted context. An attacker or malicious template author who has access to the sandboxed environment can exploit this flaw by passing arbitrary objects from the application's execution context as variant parameters. By carefully selecting keys in the apply call, they can force the library to expose sensitive internal state of these objects, such as user credentials, session tokens, or other confidential data stored within private fields. This represents a classic case of improper input validation leading to unauthorized access to restricted memory structures, aligning with CWE-200: Information Exposure and potentially CWE-918: Server-Side Request Forgery if the exposed objects facilitate further attacks against internal services.
The operational impact is particularly severe in environments where template authors are not fully trusted or where complex object graphs are passed into rendering functions for dynamic styling purposes. The vulnerability allows for a form of property injection that circumvents standard access controls, enabling data exfiltration through the rendered output stream. Furthermore, variant maps implemented as ArrayAccess objects were also susceptible to similar exploitation because they allowed key selection without proper sandbox checks, leading to potential exposure of object offsets and internal state via custom offsetGet implementations. This dual vector of attack increases the likelihood of successful exploitation across different implementation patterns within affected applications.
Mitigation strategies must focus on enforcing strict type checking before any casting operations occur. Developers should validate that inputs intended for variant configurations are strictly arrays or supported scalar types, rejecting objects entirely unless explicitly allowed by a whitelist mechanism. Upgrading to patched versions of Twig Extra HTML is the primary remediation step, as newer releases treat non-array values as single items rather than attempting array conversion, thereby preventing object introspection and ensuring that only valid array structures trigger variant matching logic. Additionally, auditing template code for any usage of html_cva with dynamic or user-supplied objects can help identify potential exposure points before deployment in production environments where sandbox integrity is critical.