CVE-2022-23614
Code injection in Twig
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
8.8
Code injection in Twig
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.
- Record
CVE-2022-23614- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-74
- Updated
- 2026-11-02
EUVDEUVD-2022-0842
8.8
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.
- Record
EUVD-2022-0842- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-5mv2-rx3q-4w2v
8.8
Code injection in Twig
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.
- Record
GHSA-5mv2-rx3q-4w2v- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-74, CWE-94
- Updated
- 2026-11-02
NVD
8.8
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.
- Record
CVE-2022-23614- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 7.5 High
AV:N/AC:L/Au:N/C:P/I:P/A:P - Weakness
- CWE-74, CWE-94
- Updated
- 2026-11-02
OSV
8.8
Code injection in Twig
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.
- Record
CVE-2022-23614- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-74
- Updated
- 2026-11-02
OSVGHSA-5mv2-rx3q-4w2v
8.8
Code injection in Twig
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.
- Record
GHSA-5mv2-rx3q-4w2v- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-74, CWE-94
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2022-23614
8.8
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.
- Record
UBUNTU-CVE-2022-23614- CVSS 3.1
- 8.8 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVDEBIAN-CVE-2022-23614 No score
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.
- Record
DEBIAN-CVE-2022-23614- Updated
- 2026-11-03
OSVUSN-5947-1 No score
php-twig, twig vulnerabilities
Fabien Potencier discovered that Twig was not properly enforcing sandbox policies when dealing with objects automatically cast to strings by PHP. An attacker could possibly use this issue to expose sensitive information. This issue was only fixed in Ubuntu 16.04 ESM and Ubuntu 18.04 ESM. (CVE-2019-9942)
Marlon Starkloff discovered that Twig was not properly enforcing closure constraints in some of its array filtering functions. An attacker could possibly use this issue to execute arbitrary code. This issue was only fixed in Ubuntu 20.04 ESM. (CVE-2022-23614)
Dariusz Tytko discovered that Twig was not properly verifying input data utilized when defining pathnames used to access files in a system. An attacker could possibly use this issue to access unauthorized resources and expose sensitive information. (CVE-2022-39261)
- Record
USN-5947-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
twig/twigPackagist |
2.0.0 up to 2.14.11 | 2.14.11 |
twig/twigPackagist |
3.0.0 up to 3.3.8 | 3.3.8 |
php-twigDebian:12 |
before 3.3.8-1 | 3.3.8-1 |
php-twigDebian:13 |
before 3.3.8-1 | 3.3.8-1 |
php-twigDebian:14 |
before 3.3.8-1 | 3.3.8-1 |
php-twigDebian:11 |
before 2.14.3-1+deb11u1, plus listed versions 2.14.3-1 |
2.14.3-1+deb11u1 |
twig/twigPackagist |
2.0.0 up to 2.14.11, plus listed versions v2.0.0v2.1.0v2.10.0v2.11.0v2.11.1 Show 45 moreShow lessv2.11.2v2.11.3v2.12.0v2.12.1v2.12.2v2.12.3v2.12.4v2.12.5v2.13.0v2.13.1v2.14.0v2.14.1v2.14.10v2.14.2v2.14.3v2.14.4v2.14.5v2.14.6v2.14.7v2.14.8v2.14.9v2.2.0v2.3.0v2.3.1v2.3.2v2.4.0v2.4.1v2.4.2v2.4.3v2.4.4v2.4.5v2.4.6v2.4.7v2.4.8v2.5.0v2.6.0v2.6.1v2.6.2v2.7.0v2.7.1v2.7.2v2.7.3v2.7.4v2.8.0v2.8.1 |
2.14.11 |
twig/twigPackagist |
3.0.0 up to 3.3.8, plus listed versions v3.0.0v3.0.1v3.0.2v3.0.3v3.0.4 Show 12 moreShow lessv3.0.5v3.1.0v3.1.1v3.2.1v3.3.0v3.3.1v3.3.2v3.3.3v3.3.4v3.3.5v3.3.6v3.3.7 |
3.3.8 |
php-twigUbuntu:Pro:20.04:LTS |
before 2.12.5-1ubuntu0.1~esm1, plus listed versions 2.11.3-22.12.1-12.12.2-12.12.3-12.12.5-1 |
2.12.5-1ubuntu0.1~esm1 |
twigUbuntu:Pro:16.04:LTS From an advisory covering 3 CVEs |
before 1.23.1-1ubuntu4+esm1, plus listed versions 1.20.0-11.23.1-1ubuntu11.23.1-1ubuntu4 |
1.23.1-1ubuntu4+esm1 |
twigUbuntu:Pro:18.04:LTS From an advisory covering 3 CVEs |
before 2.4.6-1ubuntu0.1~esm1, plus listed versions 1.24.0-2ubuntu12.4.4-2ubuntu12.4.6-1 |
2.4.6-1ubuntu0.1~esm1 |
php-twigUbuntu:Pro:20.04:LTS From an advisory covering 3 CVEs |
before 2.12.5-1ubuntu0.1~esm1, plus listed versions 2.11.3-22.12.1-12.12.2-12.12.3-12.12.5-1 |
2.12.5-1ubuntu0.1~esm1 |
php-twigUbuntu:Pro:22.04:LTS From an advisory covering 3 CVEs |
before 3.3.8-2ubuntu4+esm1, plus listed versions 3.3.2-1ubuntu33.3.4-13.3.6-13.3.7-13.3.8-2ubuntu4 |
3.3.8-2ubuntu4+esm1 |
Public exploits
Links only. Every CVE stores no exploit code.
| Source | Link | Date |
|---|---|---|
| PoC in GitHub | davwwwx/CVE-2022-23614 | 2022-07-18 |
| PoC in GitHub | 4rtamis/CVE-2022-23614 | 2023-07-04 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| exploits | OSV | |
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV, PoC in GitHub |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2022-23614 is a high vulnerability (CVSS 8.8) in Symfony Twig, published February 4, 2022. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 8.21%, the 94th percentile. Fixed in twig/twig 2.14.11.
References
github.com/twigphp/Twig/security/advisories/GHSA-5mv2-rx3q-4w2v
github.com/twigphp/Twig/commit/22b9dc3c03ee66d7e21d9ed2ca76052b134cb9e9
github.com/twigphp/Twig/commit/2eb33080558611201b55079d07ac88f207b466d5
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OTN4273U4RHVIXED64T7DSMJ3VYTPRE7
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PECHIY2XLWUH2WLCNPDGNFMPHPRPCEDZ
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I2PVV5DUTRUECTIHMTWRI5Z7DVNYQ2YO
Show 18 moreShow less
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SIGZCFSYLPP7UVJ4E4NLHSOQSKYNXSAD
debian.org/security/2022/dsa-5107
nvd.nist.gov/vuln/detail/CVE-2022-23614
lists.fedoraproject.org/archives/list/[email protected]/message/I2PVV5DUTRUECTIHMTWRI5Z7DVNYQ2YO
lists.fedoraproject.org/archives/list/[email protected]/message/OTN4273U4RHVIXED64T7DSMJ3VYTPRE7
lists.fedoraproject.org/archives/list/[email protected]/message/PECHIY2XLWUH2WLCNPDGNFMPHPRPCEDZ
lists.fedoraproject.org/archives/list/[email protected]/message/SIGZCFSYLPP7UVJ4E4NLHSOQSKYNXSAD
github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2022-23614.yaml
symfony.com/blog/twig-security-release-disallow-non-closures-in-the-sort-filter
github.com/advisories/GHSA-5mv2-rx3q-4w2v
github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23614.json
security-tracker.debian.org/tracker/CVE-2022-23614
github.com/twigphp/Twig
ubuntu.com/security/CVE-2022-23614
ubuntu.com/security/notices/USN-5947-1
cve.org/CVERecord?id=CVE-2022-23614
ubuntu.com/security/CVE-2019-9942
ubuntu.com/security/CVE-2022-39261
Left out here: 1 version. The JSON record has them.