CVE-2021-29454 Sandbox Escape by math function in smarty

High 8.1 Published Updated

Attackers can execute arbitrary PHP code via malicious math strings in the Smarty template engine, requiring an upgrade to patched versions.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2021-29454?

CVE-2021-29454 is a high-severity code injection vulnerability in Debian Debian Linux, published on 10 Jan 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Prior to versions 3.1.42 and 4.0.2, template authors could run arbitrary PHP code by crafting a malicious math string. If a math string was passed through as user provided data to the math function, external users could run arbitrary PHP code by crafting a malicious math string. Users should upgrade to version 3.1.42 or 4.0.2 to receive a patch.

Weakness: CWE-74

Which versions are affected by CVE-2021-29454?

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

PackageAffectedFixed in
smarty/smarty PackagistAll versions3.1.42
smarty/smarty PackagistAll versions3.1.42
smarty/smarty PackagistFrom 4.0.04.0.2
smarty/smarty PackagistFrom 4.0.04.0.2

Products include Debian Debian Linux, Fedoraproject Fedora, Smarty Smarty.

How do I fix CVE-2021-29454?

Upgrade smarty/smarty to a fixed version for your release line: 3.1.42 or 4.0.2.

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

Is CVE-2021-29454 being exploited?

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

All Debian Debian Linux vulnerabilities

Sources

Also known as DEBIAN-CVE-2021-29454, GHSA-29gp-2c3m-3j6m, UBUNTU-CVE-2021-29454.

Is CVE-2021-29454 in your software?

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

Check your SBOMs for free