Vulnerability · Published May 24, 2022 · Assigned by GitHub_M

CVE-2022-29221PHP Code Injection by malicious block or filename in Smarty

High 8.8

In plain English

A high-severity code injection in smarty from smarty-php. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 4.9% (higher than 92% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)8.8High
Exploit odds (30 days)4.9%top 7.8% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack tooling1Public PoC

Official 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 packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12smarty33.1.45-1DEBIAN-CVE-2022-29221
Debian:13smarty33.1.45-1DEBIAN-CVE-2022-29221
Debian:14smarty33.1.45-1DEBIAN-CVE-2022-29221
Debian:12smarty44.1.1-1DEBIAN-CVE-2022-29221
Debian:13smarty44.1.1-1DEBIAN-CVE-2022-29221
Debian:14smarty44.1.1-1DEBIAN-CVE-2022-29221
Packagistsmarty/smarty4.1.1GHSA-634x-pc3q-cf4c
Packagistsmarty/smarty3.1.45GHSA-634x-pc3q-cf4c
Ubuntu:22.04:LTSgosano fix listedUBUNTU-CVE-2022-29221
Ubuntu:24.04:LTSgosano fix listedUBUNTU-CVE-2022-29221
Ubuntu:25.10gosano fix listedUBUNTU-CVE-2022-29221
Ubuntu:26.04:LTSgosano fix listedUBUNTU-CVE-2022-29221
Ubuntu:26.10gosano fix listedUBUNTU-CVE-2022-29221
Ubuntu:22.04:LTSsmarty33.1.39-2ubuntu1.22.04.1UBUNTU-CVE-2022-29221
Ubuntu:22.04:LTSsmarty33.1.39-2ubuntu1.22.04.1USN-6012-1

Affected products (as reported)

VendorProductVersions
smarty-php smarty < 3.1.45>= 4.0.0, < 4.1.1

Weakness: CWE-94 · Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References