CVE-2022-29221
JSON

8.8high

PHP Code Injection by malicious block or filename in Smarty

Severity
8.8high CVSS:3.1 by GitHub_M
Exploit likelihood
4.91% (higher than 92% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-634x-pc3q-cf4c

Description

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.

Affected

Product or packageVersionsReported by
smarty-php smarty< 3.1.45, >= 4.0.0, < 4.1.1CVE List
smarty/smarty (Packagist)before 3.1.45, from 4.0.0 before 4.1.1GitHub Advisory Database
smarty smartybefore 3.1.45, from 4.0.0 before 4.1.1NVD
debian debian_linux9.0, 10.0, 11.0NVD
fedoraproject fedora36, 37NVD

All scores

GitHub_M8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
GitHub8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD6.5medium CVSS:2.0AV:N/AC:L/Au:S/C:P/I:P/A:P

Classification

CWE-94

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

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.

GitHub Advisory Database
Impact

Template authors could inject php code by choosing a malicous {block} name or {include} file name. Sites that cannot fully trust template authors should update asap.

Patches

Please upgrade to the most recent version of Smarty v3 or v4.

Workarounds

Is there a way for users to fix or remediate the vulnerability without upgrading?

References

Are there any links users can visit to find out more?

For more information

If you have any questions or comments about this advisory:

NVD (es)

Smarty es un motor de plantillas para PHP, que facilita la separación de la presentación (HTML/CSS) de la lógica de la aplicación. En versiones anteriores a 3.1.45 y 4.1.1, los autores de plantillas podían inyectar código php eligiendo un nombre de archivo {block} o {include} malicioso. Los sitios que no pueden confiar plenamente en los autores de plantillas deben actualizar a versiones 3.1.45 o 4.1.1 para recibir un parche para este problema. Actualmente no se presentan mitigaciones conocidas

References

https://github.com/smarty-php/smarty/security/advisories/GHSA-634x-pc3q-cf4cthird-party-advisory, web
https://github.com/smarty-php/smarty/commit/64ad6442ca1da31cefdab5c9874262b702cccdddpatch, third-party-advisory, web
https://github.com/smarty-php/smarty/releases/tag/v3.1.45release-notes, third-party-advisory, web
https://github.com/smarty-php/smarty/releases/tag/v4.1.1release-notes, third-party-advisory, web
https://lists.debian.org/debian-lts-announce/2022/05/msg00044.htmlmailing-list, third-party-advisory, web
https://www.debian.org/security/2022/dsa-5151third-party-advisory, vendor-advisory, web
https://security.gentoo.org/glsa/202209-09third-party-advisory, vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI/vendor-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ/vendor-advisory
https://nvd.nist.gov/vuln/detail/CVE-2022-29221advisory
https://github.com/FriendsOfPHP/security-advisories/blob/master/smarty/smarty/CVE-2022-29221.yamlweb
https://github.com/smarty-php/smartypackage

Sources

SourceRecordLicence
CVE ListCVE-2022-29221 changed 2025-04-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-634x-pc3q-cf4c changed 2024-02-21CC-BY-4.0
NVDCVE-2022-29221 changed 2026-06-17Public domain