{"id":"CVE-2021-29454","published":"2022-01-10T00:00:00Z","modified":"2025-04-23T19:14:05Z","title":"Sandbox Escape by math function in smarty","vendor":"smarty-php","product":"smarty","tier":"tail","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.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01861,"percentile":0.79759,"provenance":"source"},"cwes":[{"id":"CWE-74","name":"Improper Neutralization of Special Elements in Output Used by a Downstream Component"}],"references":[{"url":"https://github.com/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m","tags":[]},{"url":"https://github.com/smarty-php/smarty/commit/215d81a9fa3cd63d82fb3ab56ecaf97cf1e7db71","tags":[]},{"url":"https://github.com/smarty-php/smarty/releases/tag/v3.1.42","tags":[]},{"url":"https://github.com/smarty-php/smarty/releases/tag/v4.0.2","tags":[]},{"url":"https://packagist.org/packages/smarty/smarty","tags":[]},{"url":"https://www.smarty.net/docs/en/language.function.math.tpl","tags":[]},{"url":"https://lists.debian.org/debian-lts-announce/2022/05/msg00005.html","tags":["mailing-list"]},{"url":"https://www.debian.org/security/2022/dsa-5151","tags":["vendor-advisory"]},{"url":"https://security.gentoo.org/glsa/202209-09","tags":["vendor-advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI/","tags":["vendor-advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ/","tags":["vendor-advisory"]}],"priority":{"score":21.6,"factors":[{"name":"EPSS percentile","points":15.95},{"name":"CVSS severity","points":5.67}]},"vendorSlug":"smarty-php","affectedVersions":[{"vendor":"smarty-php","product":"smarty","versions":["< 3.1.42",">= 4.0.0, < 4.0.2"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2025-04-23T15:57:13.410401Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"Packagist","package":"smarty/smarty","vulnerableRanges":["<3.1.42",">=4.0.0, <4.0.2"],"patched":["3.1.42","4.0.2"],"from":["GHSA-29gp-2c3m-3j6m"],"provenance":"source"}],"summary":{"text":"A sandbox escape flaw in the math function of Smarty, the PHP template engine, allows template code to break out of its restricted context. An attacker who can supply a crafted math string that is passed as user-provided data to that function can execute arbitrary PHP code, and user interaction is required for the malicious input to be processed.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T07:01:23Z"},"euvd":{"id":"EUVD-2022-0423","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2018-16831","published":"2018-09-11","fixed":"3.1.33","kev":false},{"cve":"CVE-2021-26119","published":"2021-02-22","fixed":"3.1.39","kev":false},{"cve":"CVE-2021-26120","published":"2021-02-22","fixed":"3.1.39","kev":false,"link":{"from":"CVE-2021-26120","to":"CVE-2021-29454","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Packagist:smarty/smarty","fromFixed":"3.1.39","toFixed":"3.1.42","daysApart":322}]}},{"cve":"CVE-2021-29454","published":"2022-01-10","fixed":"4.0.2","kev":false},{"cve":"CVE-2021-21408","published":"2022-01-10","fixed":"4.0.3","kev":false,"link":{"from":"CVE-2021-29454","to":"CVE-2021-21408","relation":"successor","confidence":"low","kind":"sequence","orderedBy":"description","evidence":[{"kind":"version-step","provenance":"source","package":"Packagist:smarty/smarty","fromFixed":"3.1.42","toFixed":"3.1.43","daysApart":0},{"kind":"version-step","provenance":"source","package":"Packagist:smarty/smarty","fromFixed":"4.0.2","toFixed":"4.0.3","daysApart":0}]}},{"cve":"CVE-2022-29221","published":"2022-05-24","fixed":"4.1.1","kev":false},{"cve":"CVE-2018-25047","published":"2022-09-14","fixed":"4.2.1","kev":false}],"package":"Packagist:smarty/smarty"}}