Code Injection in Smarty - CVE-2022-29221

 

Code Injection in Smarty - CVE-2022-29221

Published: May 17, 2022 / Updated: July 21, 2026


Vulnerability identifier: #VU63344
CSH Severity: High
CVSS v4: 9.3 [CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N]
CVE-ID: CVE-2022-29221
CWE-ID: CWE-94
Exploitation vector: Remote access
Exploit availability: Public exploit is available

Vulnerability details

The vulnerability allows a remote attacker to execute arbitrary PHP code on the target system.

The vulnerability exists due to improper input validation when processing block name or include file name. A remote attacker can send a specially crafted request and execute arbitrary PHP code on the target system.

Successful exploitation of this vulnerability may result in complete compromise of vulnerable system.


Affected software

Smarty
Gentoo Linux
Fedora
Ubuntu
postfixadmin (Ubuntu package)
smarty3 (Debian package)
smarty3 (Ubuntu package)
php-Smarty
dev-php/smarty

How to mitigate CVE-2022-29221

Install updates from vendor's website.

Smarty - addressed in versions 3.1.45, 4.1.1
postfixadmin (Ubuntu package) - update to Ubuntu Pro
smarty3 (Debian package) - addressed in versions 3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1, 3.1.39-2+deb11u1
smarty3 (Ubuntu package) - addressed in versions 3.1.39-2ubuntu1.22.04.1, 3.1.39-2ubuntu1.22.10.1
php-Smarty - addressed in versions 3.1.47-1.el7, 3.1.47-1.fc36, 3.1.47-1.fc37
dev-php/smarty - update to 4.2.1

Links to Public Exploits and PoC-codes

External References

Related Security Bulletins