CVE-2021-29454 json
Sandbox Escape by math function in smarty
published 2022-01-10 4 y ago modified 2026-07-08 4 mo ago also GHSA-29gp-2c3m-3j6m , EUVD-2022-0423
- cvss
- 8.1
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 1.9%
- EPSS 1.9% chance of exploitation in 30 days, percentile 79%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- packagist smarty/smarty 3.1.42, 4.0.2
- smarty smarty 3.1.42, 4.0.2
- smarty3 Debian 14, Debian 13, Debian 12 3.1.45-1
- smarty4 Debian 14, Debian 13, Debian 12 4.1.1-1
debian advisories DEBIAN-CVE-2021-29454
- smarty3 Ubuntu 18.04 LTS 3.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1
- smarty3 Ubuntu 22.04 LTS 3.1.39-2ubuntu1
- smarty3 Ubuntu Pro 16.04 LTS 3.1.21-1ubuntu1+esm1
- smarty3 Ubuntu Pro 20.04 LTS 3.1.34+20190228.1.c9f0de05+selfpack1-1ubuntu0.1~esm1
ubuntu advisories UBUNTU-CVE-2021-29454
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-29454 updated cvss 8.8
php-Smarty: template authors could run arbitrary PHP code by crafting a malicious math string
-
Red Hat All currently supported Red Hat productsnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
- Assessed
- 18 mo ago
Exploit prediction
1.86% chance of exploitation in the next 30 days, higher than 79% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 8.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| NVD | 3.1 | 8.8 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 2.0 | 6.5 | AV:N/AC:L/Au:S/C:P/I:P/A:P |
| GitHub | 3.1 | 8.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| packagist | smarty/smarty | <3.1.42 >=4.0.0, <4.0.2 |
3.1.42 4.0.2 |
Affected products
- smarty-php smarty
Classification
- Weakness
-
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component
References
-
github.com
/smarty-php/smarty/commit/215d81a9fa3cd63d82fb3ab56ecaf97cf1e7db71
web, patch, third-party-advisory
-
debian.org
/security/2022/dsa-5151
vendor-advisory, web, third-party-advisory
-
security.gentoo.org
/glsa/202209-09
vendor-advisory, web, third-party-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ/
vendor-advisory
-
smarty.net
/docs/en/language.function.math.tpl
web, vendor-advisory
-
github.com
/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m
web, third-party-advisory
-
github.com
/smarty-php/smarty/releases/tag/v3.1.42
web, release-notes, third-party-advisory
-
github.com
/smarty-php/smarty/releases/tag/v4.0.2
web, release-notes, third-party-advisory
-
packagist.org
/packages/smarty/smarty
web, product, third-party-advisory
-
lists.debian.org
/debian-lts-announce/2022/05/msg00005.html
mailing-list, web, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2021-29454
advisory
-
github.com
/FriendsOfPHP/security-advisories/blob/master/smarty/smarty/CVE-2021-29454.yaml
web
-
github.com
/smarty-php/smarty
package
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI
web
Sources
- CVE List CVE-2021-29454
- GitHub Advisory GHSA-29gp-2c3m-3j6m
- NVD CVE-2021-29454
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.