Code Injection in Smarty - CVE-2021-29454
Published: March 28, 2022
Vulnerability identifier: #VU61664
CSH Severity: High
CVSS v4: 8.7 [CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N]
CVE-ID: CVE-2021-29454
CWE-ID: CWE-94
Exploitation vector: Remote access
Exploit availability:
No public exploit available
Vulnerability details
The vulnerability allows a remote user to execute arbitrary PHP code on the target system.
The vulnerability exists due to improper input validation. A remote user can inject a malicious math string into he PHP template and execute arbitrary PHP code on the system.
Affected software
Smarty
Gentoo Linux
Fedora
Ubuntu
smarty3 (Ubuntu package)
smarty3 (Debian package)
php-Smarty
dev-php/smarty
Gentoo Linux
Fedora
Ubuntu
smarty3 (Ubuntu package)
smarty3 (Debian package)
php-Smarty
dev-php/smarty
How to mitigate CVE-2021-29454
Install updates from vendor's website.
Smarty - addressed in versions 3.1.42, 4.0.2
smarty3 (Ubuntu package) - addressed in versions 3.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1, 3.1.39-2ubuntu0.21.10.1
smarty3 (Debian package) - addressed in versions 3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1, 3.1.39-2+deb11u1
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
smarty3 (Ubuntu package) - addressed in versions 3.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1, 3.1.39-2ubuntu0.21.10.1
smarty3 (Debian package) - addressed in versions 3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1, 3.1.39-2+deb11u1
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
External References
- https://github.com/smarty-php/smarty/commit/215d81a9fa3cd63d82fb3ab56ecaf97cf1e7db71
- https://github.com/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m
- https://packagist.org/packages/smarty/smarty
- https://github.com/smarty-php/smarty/releases/tag/v3.1.42
- https://www.smarty.net/docs/en/language.function.math.tpl
- https://github.com/smarty-php/smarty/releases/tag/v4.0.2