Code Injection in Smarty - CVE-2022-29221
Published: May 17, 2022 / Updated: July 21, 2026
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
Gentoo Linux
Fedora
Ubuntu
postfixadmin (Ubuntu package)
smarty3 (Debian package)
smarty3 (Ubuntu package)
php-Smarty
dev-php/smarty
How to mitigate CVE-2022-29221
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