CVE-2021-29454: Sandbox Escape by math function in smarty

Published Jan 10, 2022
·
Updated

Impact Template authors could run arbitrary PHP code by crafting a malicious math string. If a math string is passed through as user provided data to the math function, external users could run arbitrary PHP code by crafting a malicious math string.

Patches Please upgrade to 4.0.2 or 3.1.42 or higher.

References See documentation on Math function.

For more information If you have any questions or comments about this advisory please open an issue in the Smarty repo

Other sources

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. Users should upgrade to version 3.1.42 or 4.0.2 to receive a patch.

Affected Software

12 affected componentsFixes available
composer/smarty/smarty<3.1.42, >=4.0.0, <4.0.2
debian/smarty3
3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u13.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u23.1.39-2+deb11u13.1.47-23.1.48-1
debian/smarty4
4.3.0-1+deb12u14.3.1-1
composer/smarty/smarty>=4.0.0<4.0.2
4.0.2
composer/smarty/smarty<3.1.42
3.1.42
Smarty smarty<3.1.42
Smarty smarty>=4.0.0<4.0.2
Debian Debian Linux=9.0
Debian Debian Linux=10.0
Debian Debian Linux=11.0
Fedoraproject Fedora=36
Fedoraproject Fedora=37

Event History

Jan 10, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Advisory Published
12:01 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2021-29454?

CVE-2021-29454 is categorized as a high severity vulnerability due to the ability of attackers to execute arbitrary PHP code.

2

How do I fix CVE-2021-29454?

To fix CVE-2021-29454, upgrade Smarty to version 4.0.2 or 3.1.42 or later versions mentioned in the advisory.

3

Who is affected by CVE-2021-29454?

CVE-2021-29454 affects users of Smarty versions prior to 4.0.2 and 3.1.42.

4

What types of attacks can CVE-2021-29454 facilitate?

CVE-2021-29454 facilitates remote code execution attacks through crafted malicious math strings.

5

Are there any known exploits for CVE-2021-29454?

There are currently no public exploits specific to CVE-2021-29454, but the vulnerability allows for arbitrary code execution, making it highly dangerous.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203