All vulnerabilities

Servers and applications

CVE-2021-29454

Sandbox Escape by math function

Severity
High 8.8
Published
9 Jan 2022
Last changed
17 Jun 2026
Added to UpHeron
1 Nov 2026
Fixed in
3.1.42, 4.0.2
Also known as
GHSA-29gp-2c3m-3j6m
Sources
NVD, Project advisories (GitHub)

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.…

Affected software

SoftwareAffected versions
SmartyServers and applications · cpe:a:smarty:smarty
  • Every version before 3.1.42
  • From 4.0.0 before 4.0.2
SmartyServers and applications · github:smarty-php/smarty
  • Every version before 3.1.42
  • Every version before 4.0.2

References

  • NVD https://nvd.nist.gov/vuln/detail/CVE-2021-29454
  • CVE.org https://www.cve.org/CVERecord?id=CVE-2021-29454
  • GitHub Advisory Database https://github.com/advisories/GHSA-29gp-2c3m-3j6m
  • github.com https://github.com/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m