Every CVE Search/ Get API key

CVE-2022-23614

Code injection in Twig

8.8 HighPublic exploitFix available

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

8.21%Up 7.3 points since Feb 8, 2022
90%50%10%1%

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 HighCVSS: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 HighCVSS: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 HighCVSS: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 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS 3.1
9.8 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
7.5 HighAV: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 HighCVSS: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 HighCVSS: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 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS 3.1
9.8 CriticalCVSS: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

Affected packages
PackageAffectedFixed
twig/twig
Packagist
2.0.0 up to 2.14.11
2.14.11
twig/twig
Packagist
3.0.0 up to 3.3.8
3.3.8
php-twig
Debian:12
before 3.3.8-1
3.3.8-1
php-twig
Debian:13
before 3.3.8-1
3.3.8-1
php-twig
Debian:14
before 3.3.8-1
3.3.8-1
php-twig
Debian:11
before 2.14.3-1+deb11u1, plus listed versions
2.14.3-1
2.14.3-1+deb11u1
twig/twig
Packagist
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 less
v2.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/twig
Packagist
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 less
v3.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-twig
Ubuntu: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
twig
Ubuntu: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
twig
Ubuntu: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-twig
Ubuntu: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-twig
Ubuntu: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.

Public exploits
SourceLinkDate
PoC in GitHubdavwwwx/CVE-2022-236142022-07-18
PoC in GitHub4rtamis/CVE-2022-236142023-07-04

History

History
RecordedChangedSources
affected, facts
exploitsOSV
first indexedCVE 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

Show 18 moreShow less
This page doesn't list everything

Left out here: 1 version. The JSON record has them.

MoveEnter Open