Skip to main content
← All vulnerabilities
CVE-2022-39261DRUPAL-CORE-2022-016BIT-DRUPAL-2022-39261GHSA-52M2-VC4M-JJ33

Twig may load a template outside a configured directory when using the filesystem loader

Published
Last modified
published
Not listed in CISA KEV
Fix
Fixed in 2.15.3, 3.4.3, 9.3.22, 9.4.7, 1.44.7
None on Exploit-DB, Metasploit or GitHub
  • Exploitation: none
  • Automatable: yes
  • Technical impact: partial

Summary

Twig is a template language for PHP. Versions 1.x prior to 1.44.7, 2.x prior to 2.15.3, and 3.x prior to 3.4.3 encounter an issue when the filesystem loader loads templates for which the name is a user input. It is possible to use the `source` or `include` statement to read arbitrary files from outside the templates' directory when using a namespace like `@somewhere/../some.file`. In such a case, validation is bypassed. Versions 1.44.7, 2.15.3, and 3.4.3 contain a fix for validation of such template names. There are no known workarounds aside from upgrading.

Timeline

  1. CVE published
  2. CISA SSVC assessment

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

  3. Record last updated

Affected versions

  • twigphp Twig

    From 2.0.0 · fixed in 2.15.3; From 3.0.0 · fixed in 3.4.3

  • drupal/corePackagist

    From 8.0.0 · fixed in 9.3.22; From 9.4.0 · fixed in 9.4.7

  • twig/twigPackagist

    From 1.0.0 · fixed in 1.44.7

  • twig/twigPackagist

    From 2.0.0 · fixed in 2.15.3

  • twig/twigPackagist

    From 3.0.0 · fixed in 3.4.3

References 11

GitHub · twigphp/Twig

drupal.org

debian.org

lists.fedoraproject.org

lists.debian.org