Skip to content
Fencer Vulns
high 8.1

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 products
    not 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

Sources

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.