CVE-2022-23614 Code injection in Twig

High 8.8 Published Updated

Attackers can execute arbitrary PHP code via the sort filter in Twig sandbox mode due to improper closure validation.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-23614?

CVE-2022-23614 is a high-severity code injection vulnerability in Debian Debian Linux, published on 4 Feb 2022. Any signed-in user can exploit it over the network, with no action from the victim.

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.

Weakness: CWE-94, CWE-74

Which versions are affected by CVE-2022-23614?

4 open source packages ship an affected version, including twig/twig. It affects 3 products.

PackageAffectedFixed in
twig/twig PackagistFrom 2.0.02.14.11
twig/twig PackagistFrom 2.0.02.14.11
twig/twig PackagistFrom 3.0.03.3.8
twig/twig PackagistFrom 3.0.03.3.8

Products include Debian Debian Linux, Fedoraproject Fedora, Symfony Twig.

How do I fix CVE-2022-23614?

Upgrade twig/twig to a fixed version for your release line: 2.14.11 or 3.3.8.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2022-23614 being exploited?

There is no known exploitation of CVE-2022-23614 in the wild and no public exploit code.

Public exploit code: 2 proofs of concept on GitHub.

All Debian Debian Linux vulnerabilities

Sources

Also known as DEBIAN-CVE-2022-23614, DSA-5107-1, GHSA-5mv2-rx3q-4w2v, UBUNTU-CVE-2022-23614.

Is CVE-2022-23614 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free