Security restrictions bypass in Smarty - CVE-2021-26119

 

Security restrictions bypass in Smarty - CVE-2021-26119

Published: February 23, 2021 / Updated: July 21, 2026


Vulnerability identifier: #VU50869
CSH Severity: Medium
CVSS v4: 8.6 [CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N]
CVE-ID: CVE-2021-26119
CWE-ID: CWE-264
Exploitation vector: Remote access
Exploit availability: Public exploit is available

Vulnerability details

The vulnerability allows a remote user to escalate privileges within the application.

The vulnerability exists due to application does not properly impose security restrictions and allows to escape sandbox by allowing to access the $smarty.template_object. A remote user can perform template injection and execute arbitrary PHP code on the server.


Affected software

Smarty
Gentoo Linux
Fedora
Ubuntu
smarty3 (Ubuntu package)
smarty3 (Debian package)
php-Smarty

How to mitigate CVE-2021-26119

Install updates from vendor's website.

Smarty - update to 3.1.39
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

Links to Public Exploits and PoC-codes

External References

Related Security Bulletins