CVE-2022-39261: Twig may load a template outside a configured directory when using the filesystem loader

Published Sep 28, 2022
·
Updated

Possibility to load a template outside a configured directory when using the filesystem loader

Other sources

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.

Affected Software

13 affected componentsFixes available
composer/twig/twig>=1.0.0, <1.44.7, >=2.0.0, <2.15.3, >=3.0.0, <3.4.3
debian/php-twig
2.14.3-1+deb11u23.5.1-13.7.1-1
debian/twig<=2.6.2-2
2.6.2-2+deb10u1
Symfony Twig>=1.0.0<1.44.7
Symfony Twig>=2.0.0<2.15.3
Symfony Twig>=3.0.0<3.4.3
Drupal Drupal>=8.0.0<9.3.22
Drupal Drupal>=9.4.0<9.4.7
Fedoraproject Fedora=35
Fedoraproject Fedora=36
Fedoraproject Fedora=37
Debian Debian Linux=10.0
Debian Debian Linux=11.0

Event History

Sep 28, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Advisory Published
10:36 AM
Sep 30, 2022
Data Sourced
07:45 AM
SeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2022-39261?

CVE-2022-39261 is a vulnerability that allows the loading of a template outside of a configured directory when using the filesystem loader in Twig.

2

Which software packages are affected by CVE-2022-39261?

The Twig package versions 1.0.0 to 1.44.7, 2.0.0 to 2.15.3, and 3.0.0 to 3.4.3 are affected by CVE-2022-39261.

3

What is the severity of CVE-2022-39261?

The severity of CVE-2022-39261 is moderate.

4

How can I fix CVE-2022-39261?

To fix CVE-2022-39261, upgrade the Twig package to a version higher than 1.44.7, 2.15.3, or 3.4.3.

5

Where can I find more information about CVE-2022-39261?

You can find more information about CVE-2022-39261 at the following reference link: [https://symfony.com/blog/twig-security-release-possibility-to-load-a-template-outside-a-configured-directory-when-using-the-filesystem-loader](https://symfony.com/blog/twig-security-release-possibility-to-load-a-template-outside-a-configured-directory-when-using-the-filesystem-loader)

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203