CVE-2026-133764 in Twiginfo

Summary

by MITRE • 11/24/2026

The sandbox checks that a template may call toString() on an object before converting it to a string. It didn't check the input of tests. The PHP callable of a test may convert this input to a string, for example when its parameter is typed as string. PHP then calls toString() on an object without the sandbox checking it first:

{{ obj is upperish }}

Applications are affected when they register such a test and allow it in the sandbox. No built-in test is affected.

The sandbox now checks the input of tests like the input of filters. The built-in tests that never convert their input to a string still skip the check.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 11/24/2026

This vulnerability represents a logic flaw within the template engine's security sandbox, specifically concerning how it validates callable inputs for test constructs. In typical web application development using this templating system, developers often register custom tests or filters that may perform type coercion on their arguments. The core issue arises when an object is passed to such a test and the underlying PHP implementation of that test explicitly converts its input parameter to a string, either through implicit casting or explicit typing declarations like declaring a parameter as a string. Under normal circumstances, the sandbox should intercept this operation to ensure safety, but in the affected versions, it fails to validate whether the object possesses a safe toString method before allowing the conversion to proceed. This oversight creates a gap where malicious objects with dangerous magic methods can be instantiated and processed within the template context without triggering the expected security checks.

The technical root cause lies in the asymmetry of validation logic between filters and tests prior to the patch. The sandbox implementation correctly validates inputs for filters, ensuring that any object passed through is checked against a whitelist or validated for safe string conversion capabilities before execution. However, this same rigorous check was absent for test constructs. When an application registers a custom test function that accepts an object and subsequently casts it to a string, the PHP engine invokes the __toString magic method on that object. Because the sandbox did not pre-check this input stream, any arbitrary code defined within that toString implementation is executed in the context of the template rendering process. This effectively bypasses the intended isolation boundaries established by the sandbox configuration, allowing for potential remote code execution or information disclosure depending on what the malicious __toString method achieves.

The operational impact of this vulnerability is significant for applications that rely heavily on custom templating logic and allow user-supplied data to influence object instantiation within templates. Although no built-in tests are affected because they do not perform string conversion on their inputs, any third-party extension or application-specific test that coerces its argument into a string becomes an attack vector. An attacker who can control the input passed to such a vulnerable test could inject objects with crafted __toString methods. This leads to unauthorized code execution within the server-side environment where the template engine operates. The severity is further compounded by the fact that this bypass occurs at the language level through PHP's native type juggling and magic method invocation, making it difficult for developers to detect without deep inspection of their custom test implementations or reliance on outdated sandbox configurations.

Mitigation strategies primarily involve upgrading to a patched version of the template engine where the sandbox logic has been harmonized across both filters and tests. In these updated versions, the input validation mechanism treats test arguments with the same scrutiny as filter arguments, ensuring that any object undergoing string conversion is first verified for safety. For applications unable to upgrade immediately, developers should audit their custom test implementations to ensure they do not implicitly or explicitly cast inputs to strings unless those inputs are strictly typed and validated beforehand. Additionally, restricting the sandbox configuration to only allow whitelisted classes with known safe toString methods can provide a defensive layer against this specific bypass technique. It is also advisable to review any third-party template extensions for similar patterns of unchecked object-to-string conversion to ensure comprehensive protection against this class of vulnerability.

Responsible

Symfony

Reservation

11/20/2026

Disclosure

11/24/2026

Moderation

accepted

CPE

ready

EPSS

0.00533

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!