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

- Priority: **Routine**
- Reason: Not severe (CVSS 8.1, network access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2022-01-10 · Modified: 2025-04-23
- Aliases: UBUNTU-CVE-2021-29454, DEBIAN-CVE-2021-29454
- Record: https://cvemate.com/vulnerability/CVE-2021-29454 · JSON: https://cvemate.com/vulnerability/CVE-2021-29454/json

## Description

```text
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.
```

## Signals

- CVSS: 8.8 high (v3.1, NVD) CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- EPSS: 1.861%, percentile 79.994%, as of 2026-12-05
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected

- debian smarty3 (Debian): \< 3.1.45-1
- debian smarty4 (Debian): \< 4.1.1-1
- ubuntu smarty3 (Ubuntu): \< 3.1.21-1ubuntu1+esm1 \| \< 3.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1 \| \< 3.1.34+20190228.1.c9f0de05+selfpack1-1ubuntu0.1~esm1 \| \< 3.1.39-2ubuntu1
- debian debian\_linux: 9.0 \| 10.0 \| 11.0
- fedoraproject fedora: 36 \| 37
- smarty-php smarty: \< 3.1.42 \| ≥ 4.0.0, \< 4.0.2
- smarty smarty: \< 3.1.42 \| ≥ 4.0.0, \< 4.0.2

## References

- <https://github.com/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m>
- <https://github.com/smarty-php/smarty/commit/215d81a9fa3cd63d82fb3ab56ecaf97cf1e7db71>
- <https://github.com/smarty-php/smarty/releases/tag/v3.1.42>
- <https://github.com/smarty-php/smarty/releases/tag/v4.0.2>
- <https://packagist.org/packages/smarty/smarty>
- <https://www.smarty.net/docs/en/language.function.math.tpl>
- <https://lists.debian.org/debian-lts-announce/2022/05/msg00005.html>
- <https://www.debian.org/security/2022/dsa-5151>
- <https://security.gentoo.org/glsa/202209-09>
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI/>
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ/>
- <https://ubuntu.com/security/CVE-2021-29454>
- <https://ubuntu.com/security/notices/USN-5348-1>
- <https://ubuntu.com/security/notices/USN-5348-3>
- <https://ubuntu.com/security/notices/USN-5348-2>
- <https://www.cve.org/CVERecord?id=CVE-2021-29454>
- <https://security-tracker.debian.org/tracker/CVE-2021-29454>

---

Data as of 2026-12-05T14:50:45.641Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
