{"id":"CVE-2022-29221","published":"2022-05-24T00:00:00Z","modified":"2025-04-23T18:22:54Z","title":"PHP Code Injection by malicious block or filename 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.45 and 4.1.1, template authors could inject php code by choosing a malicious {block} name or {include} file name. Sites that cannot fully trust template authors should upgrade to versions 3.1.45 or 4.1.1 to receive a patch for this issue. There are currently no known workarounds.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.04914,"percentile":0.92316,"provenance":"source"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"references":[{"url":"https://github.com/smarty-php/smarty/security/advisories/GHSA-634x-pc3q-cf4c","tags":[]},{"url":"https://github.com/smarty-php/smarty/commit/64ad6442ca1da31cefdab5c9874262b702cccddd","tags":[]},{"url":"https://github.com/smarty-php/smarty/releases/tag/v3.1.45","tags":[]},{"url":"https://github.com/smarty-php/smarty/releases/tag/v4.1.1","tags":[]},{"url":"https://lists.debian.org/debian-lts-announce/2022/05/msg00044.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":29.6,"factors":[{"name":"EPSS percentile","points":18.46},{"name":"Public exploit code","points":5.0},{"name":"CVSS severity","points":6.16}]},"exploitSources":{"pocGithub":{"count":1,"skipped":0,"earliest":"2022-05-25","earliestUrl":"https://github.com/sbani/CVE-2022-29221-PoC","repos":[{"name":"sbani/CVE-2022-29221-PoC","url":"https://github.com/sbani/CVE-2022-29221-PoC","stars":16,"created":"2022-05-25"}]},"first":{"date":"2022-05-25","source":"PoC-in-GitHub","url":"https://github.com/sbani/CVE-2022-29221-PoC"},"provenance":"source"},"vendorSlug":"smarty-php","affectedVersions":[{"vendor":"smarty-php","product":"smarty","versions":["< 3.1.45",">= 4.0.0, < 4.1.1"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2025-04-23T15:52:58.668263Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"Packagist","package":"smarty/smarty","vulnerableRanges":["<3.1.45",">=4.0.0, <4.1.1"],"patched":["3.1.45","4.1.1"],"from":["GHSA-634x-pc3q-cf4c"],"provenance":"source"}],"summary":{"text":"The flaw is a PHP code injection weakness in the Smarty template engine (smarty-php/smarty), where a template author can inject PHP code through a malicious {block} name or {include} file name. An attacker who can author templates on a site can use this to execute arbitrary PHP, with the attack reachable over the network and requiring only low-privilege template-authoring access and no user interaction.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-21T04:02:45Z"},"euvd":{"id":"EUVD-2022-2696","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-smarty-php-smarty-cve-2021-26120","parents":[{"from":"CVE-2021-26120","to":"CVE-2022-29221","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["libs/sysplugins/smarty_internal_compile_function.php"],"commits":["https://github.com/smarty-php/smarty/commit/165f1bd4d2eec328cfeaca517a725b46001de838","https://github.com/smarty-php/smarty/commit/64ad6442ca1da31cefdab5c9874262b702cccddd"],"basis":"shared function","functions":["compile"]}]}],"packageHistory":[{"cve":"CVE-2021-26120","published":"2021-02-22","fixed":"3.1.39","kev":false},{"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-21408","to":"CVE-2022-29221","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Packagist:smarty/smarty","fromFixed":"3.1.43","toFixed":"3.1.45","daysApart":134},{"kind":"version-step","provenance":"source","package":"Packagist:smarty/smarty","fromFixed":"4.0.3","toFixed":"4.1.1","daysApart":134}]}},{"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,"link":{"from":"CVE-2022-29221","to":"CVE-2018-25047","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Packagist:smarty/smarty","fromFixed":"3.1.45","toFixed":"3.1.47","daysApart":113},{"kind":"version-step","provenance":"source","package":"Packagist:smarty/smarty","fromFixed":"4.1.1","toFixed":"4.2.1","daysApart":113}]}},{"cve":"CVE-2023-28447","published":"2023-03-28","fixed":"4.3.1","kev":false},{"cve":"CVE-2024-35226","published":"2024-05-28","fixed":"5.1.1","kev":false}],"package":"Packagist:smarty/smarty"}}