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

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.

Published: 2022-01-10 Last update: 2024-11-21 Assigner: [email protected] Source: [email protected]

Conclusion & alert: CVE-2021-29454 is rated Moderate Risk (57.2/100): CVSS High severity, with medium exploitation likelihood (EPSS 0.64%). Mandatory action: Review affected assets and schedule remediation.

Risk is dynamic; we continuously reassess and refresh what is shown on this page as upstream context changes.

Exploit prediction scoring system (EPSS) score for CVE-2021-29454

EPSS lead: Daily EPSS estimates relative likelihood of exploitation; percentile ranks this CVE among scored vulnerabilities (higher = more severe relative rank).

# Date Old EPSS score New EPSS score Delta (New - Old)
1 2026-01-25 0.40% 0.64% +0.25%
2 2025-12-28 0.33% 0.40% +0.06%
3 2025-12-27 0.33%

Full EPSS history (20 records total)

Common vulnerability scoring system (CVSS) metrics for CVE-2021-29454

CVSS metrics for this CVE.

Base score Version Severity Vector Exploitability Impact Score source
8.1 3.1 HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:N)
Service keeps running; no real outage angle.
2.8 5.2 [email protected]
8.8 3.1 HIGH
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:L)
A normal user session is enough; they don’t have to be admin.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:H)
Could take the service down hard or make it unusable for people who depend on it.
2.8 5.9 [email protected]
6.5 2.0 MEDIUM
AV:N/AC:L/Au:S/C:P/I:P/A:P Click to expand
Access vector (AV:N)
Can be exploited remotely over network reachability.
Access complexity (AC:L)
Exploitation conditions are straightforward and predictable.
Authentication (AU:S)
A single authentication is required.
Confidentiality impact (C:P)
Partial confidentiality impact.
Integrity impact (I:P)
Partial integrity impact.
Availability impact (A:P)
Partial availability impact.
8.0 6.4 [email protected]

Weakness enumeration for CVE-2021-29454

GitHub Security Advisory for CVE-2021-29454

GHSA-29gp-2c3m-3j6m · Severity: high · Ecosystem: composer — Sandbox Escape by math function in smarty

OS Trackers for CVE-2021-29454

vendor priority summary link
debian not yet assigned CVE-2021-29454 not yet assigned priority: Debian including 2 source packages (smarty3, smarty4), 9 status rows across 5 suites (bookworm, bullseye, forky, sid, trixie): resolved 9. https://security-tracker.debian.org/tracker/CVE-2021-29454
gentoo normal CVE-2021-29454: 1 GLSA(s) (202209-09), 1 atom(s) (dev-php/smarty); latest impact normal. https://bugs.gentoo.org/buglist.cgi?quicksearch=CVE-2021-29454
ubuntu high CVE-2021-29454 high priority: Ubuntu including 1 source packages (smarty3), 14 status rows across 14 suites (bionic, focal, hirsute, impish, jammy, kinetic, lunar, mantic, noble, oracular, plucky, trusty, upstream, xenial): released 12, DNE 1, ignored 1. https://ubuntu.com/security/CVE-2021-29454

Affected software / configurations for CVE-2021-29454

Vendor Product Version Raw CPE
smarty smarty < 3.1.42 cpe:2.3:a:smarty:smarty:*:*:*:*:*:*:*:*
smarty smarty >= 4.0.0, < 4.0.2 cpe:2.3:a:smarty:smarty:*:*:*:*:*:*:*:*
debian debian_linux 9.0 cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*
debian debian_linux 10.0 cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*
debian debian_linux 11.0 cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*
fedoraproject fedora 36 cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*
fedoraproject fedora 37 cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:*

References for CVE-2021-29454

URL Tags
https://github.com/smarty-php/smarty/commit/215d81a9fa3cd63d82fb3ab56ecaf97cf1e7db71 Patch Third Party Advisory
https://github.com/smarty-php/smarty/releases/tag/v3.1.42 Release Notes Third Party Advisory
https://github.com/smarty-php/smarty/releases/tag/v4.0.2 Release Notes Third Party Advisory
https://github.com/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m Third Party Advisory
https://lists.debian.org/debian-lts-announce/2022/05/msg00005.html Mailing List Third Party Advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ/
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI/
https://packagist.org/packages/smarty/smarty Product Third Party Advisory
https://security.gentoo.org/glsa/202209-09 Third Party Advisory
https://www.debian.org/security/2022/dsa-5151 Third Party Advisory
https://www.smarty.net/docs/en/language.function.math.tpl Vendor Advisory
cvelogic Threat Intelligence