CVE-2022-23614: Code injection in Twig

Published Feb 4, 2022
·
Updated

Description

When in a sandbox mode, the arrow parameter of the sort filter must be a closure to avoid attackers being able to run arbitrary PHP functions.

Resolution

We now disallow calling non Closure in the sort filter like we already did for some other filters.

Credits

We would like to thank Marlon Starkloff for reporting the issue and Fabien Potencier for fixing the issue.

Other sources

Disallow non closures in the sort filter

Twig is an open source template language for PHP. When in a sandbox mode, the arrow parameter of the sort filter must be a closure to avoid attackers being able to run arbitrary PHP functions. In affected versions this constraint was not properly enforced and could lead to code injection of arbitrary PHP code. Patched versions now disallow calling non Closure in the sort filter as is the case for some other filters. Users are advised to upgrade.

Affected Software

10 affected componentsFixes available
composer/twig/twig>=2.0.0, <2.14.11, >=3.0.0, <3.3.8
debian/php-twig
2.14.3-1+deb11u23.5.1-13.7.1-1
debian/twig
2.6.2-22.6.2-2+deb10u1
composer/twig/twig>=3.0.0<3.3.8
3.3.8
composer/twig/twig>=2.0.0<2.14.11
2.14.11
Symfony Twig>=2.0.0<2.14.11
Symfony Twig>=3.0.0<3.3.8
Fedoraproject Fedora=34
Fedoraproject Fedora=35
Debian Debian Linux=11.0

Event History

Feb 4, 2022
Advisory Published
06:54 AM
CVE Published
via MITRE·10:25 PM
Data Sourced
via MITRE·10:25 PM
DescriptionSeverityWeakness
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 the vulnerability ID for this issue?

The vulnerability ID for this issue is CVE-2022-23614.

2

What is the title of this vulnerability?

The title of this vulnerability is "Disallow non closures in the sort filter".

3

What is the affected software?

The affected software is Twig.

4

What versions of Twig are affected?

Twig versions 2.0.0 to 2.14.11 and 3.0.0 to 3.3.8 are affected.

5

Where can I find more information about this vulnerability?

You can find more information about this vulnerability at the following link: [Twig Security Release](https://symfony.com/blog/twig-security-release-disallow-non-closures-in-the-sort-filter)

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