Skip to main content
← All vulnerabilities
CVE-2026-47732GHSA-PR2W-4GPJ-CPQ4

Twig Sandbox: multiple `__toString()` policy bypasses via unguarded string coercion points

Published
Last modified
published
Not listed in CISA KEV
Fix
Fixed in 3.26.0
None on Exploit-DB, Metasploit or GitHub
  • Exploitation: none
  • Automatable: no
  • Technical impact: partial

Summary

Twig is a template language for PHP. Prior to 3.26.0, several Twig language constructs trigger PHP string coercion on a Stringable operand without consulting SecurityPolicy::checkMethodAllowed(), allowing a sandboxed template author to invoke __toString() on objects reachable in the render context through conditional expressions, comparison operators, tests, template-loading tags, dynamic attribute names, spread arguments, the do tag, and the .. range operator. This issue is fixed in version 3.26.0.

Timeline

  1. CVE published
  2. CISA SSVC assessment

    Exploitation: none · Automatable: no · Technical impact: partial

  3. Record last updated

Affected versions

  • twigphp Twig

    fixed in 3.26.0

  • twig/twigPackagist

    fixed in 3.26.0

References 3

GitHub · twigphp/Twig