Vulnerabilities / CVE-2022-23614

critical

CVE-2022-23614

twig: Disallow non closures in `sort` filter when the sandbox mode is enabled

Published Modified CWE 74, 94
In the Trivy database since at least 24 Oct 2026, 07:11 UTCWhen it arrived before that build is not recorded.

Severity by source

NVD9.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GHSA8.8CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Red Hat8.8CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Trivy's own label is CRITICAL. Rated critical by NVD. Rated lower by GHSA (high), Red Hat (medium), Ubuntu (medium).

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 and fixed versions

SourcePackageFixed in
composer::GitHub Security Advisory Composertwig/twig2.14.11, 3.3.8
composer::PHP Security Advisories Databasetwig/twigno fix listed
debian 11php-twig2.14.3-1+deb11u1
debian 12php-twig3.3.8-1
debian 13php-twig3.3.8-1
debian 14php-twig3.3.8-1
echophp-twig3.3.8-1
ubuntu 20.04-ESMphp-twig2.12.5-1ubuntu0.1~esm1

References

All 19 references

Vulnerability data compiled from the Trivy vulnerability database (trivy-db, Aqua Security, Apache License 2.0), which aggregates third-party advisories. CVE records are published by The MITRE Corporation under the CVE Terms of Use; CVE is a trademark of MITRE. This product uses data from the NVD API but is not endorsed or certified by the NVD. Severity, titles and advisory data from the GitHub Advisory Database (CC BY 4.0), Red Hat security data (CC BY 4.0) and the other sources linked on each entry. Entries may be summarised or re-formatted; the linked original is the authoritative record.