Vulnerability · Published Feb 4, 2022 · Assigned by GitHub_M
CVE-2022-23614Code injection in Twig
High 8.8
In plain English
A high-severity injection in Twig from twigphp. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 8.2% (higher than 95% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.
Official description
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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | php-twig | 3.3.8-1 | DEBIAN-CVE-2022-23614 |
| Debian:13 | php-twig | 3.3.8-1 | DEBIAN-CVE-2022-23614 |
| Debian:14 | php-twig | 3.3.8-1 | DEBIAN-CVE-2022-23614 |
| Packagist | twig/twig | 2.14.11 | GHSA-5mv2-rx3q-4w2v |
| Packagist | twig/twig | 3.3.8 | GHSA-5mv2-rx3q-4w2v |
Affected products (as reported)
Weakness: CWE-74 · Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/twigphp/Twig/security/advisories/GHSA-5mv2-rx3q-4w2v x_refsource_CONFIRM
- https://github.com/twigphp/Twig/commit/22b9dc3c03ee66d7e21d9ed2ca76052b134cb9e9 x_refsource_MISC
- https://github.com/twigphp/Twig/commit/2eb33080558611201b55079d07ac88f207b466d5 x_refsource_MISC
- FEDORA-2022-167b9becef vendor-advisory, x_refsource_FEDORA
- FEDORA-2022-47293b1d23 vendor-advisory, x_refsource_FEDORA
- FEDORA-2022-7d871d7583 vendor-advisory, x_refsource_FEDORA
- FEDORA-2022-58abb323f0 vendor-advisory, x_refsource_FEDORA
- DSA-5107 vendor-advisory, x_refsource_DEBIAN