PT-2026-47219 · Twig · Twig

CVE-2026-48806

·

Published

2026-05-27

·

Updated

2026-07-15

CVSS v3.1

9.1

Critical

VectorAV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Name of the Vulnerable Software and Affected Versions Twig versions prior to 3.26.0
Description An issue exists where the sandbox visitor fails to wrap mapping keys in ArrayExpression with CheckToStringNode. When a dynamic key expression resolves to a Stringable object, the ArrayExpression::compile() function emits a raw cast or no cast at all, causing PHP to invoke the toString() method directly. This bypasses the SandboxExtension::ensureToStringAllowed() check, allowing a sandboxed template author to trigger toString() on any object reachable in the render context by using it as a dynamic mapping key. This can lead to the unauthorized disclosure of data returned by the toString() method.
Recommendations Update to version 3.26.0 or later.

Exploit

Fix

Protection Mechanism Failure

Incorrect Authorization

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

CVE-2026-48806
GHSA-5V5V-WW74-355V

Affected Products

Twig