Every CVE Search/ Get API key

CVE-2022-29221

PHP Code Injection by malicious block or filename in Smarty

8.8 HighPublic exploitFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
Low
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
High

Exploit likelihood

4.91%Up 4.0 points since May 25, 2022
90%50%10%1%

What each source reports

CVE List Score used 8.8

PHP Code Injection by malicious block or filename in Smarty

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.

Record
CVE-2022-29221
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-94
Updated
2026-11-02
EUVDEUVD-2022-2696 8.8

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.

Record
EUVD-2022-2696
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-634x-pc3q-cf4c 8.8

PHP Code Injection by malicious block or filename in Smarty

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:

Record
GHSA-634x-pc3q-cf4c
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-94
Updated
2026-11-02
NVD 8.8

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.

Record
CVE-2022-29221
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
6.5 MediumAV:N/AC:L/Au:S/C:P/I:P/A:P
Weakness
CWE-94
Updated
2026-11-02
OSV 8.8

PHP Code Injection by malicious block or filename in Smarty

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.

Record
CVE-2022-29221
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-94
Updated
2026-11-02
OSVDEBIAN-CVE-2022-29221 8.8

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.

Record
DEBIAN-CVE-2022-29221
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-03
Show 5 moreShow less
OSVGHSA-634x-pc3q-cf4c 8.8

PHP Code Injection by malicious block or filename in Smarty

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:

Record
GHSA-634x-pc3q-cf4c
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weakness
CWE-94
Updated
2026-11-02
OSVUBUNTU-CVE-2022-29221 8.8

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.

Record
UBUNTU-CVE-2022-29221
CVSS 3.1
8.8 HighCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVMGASA-2022-0226 No score

Updated php-smarty packages fix security vulnerability

Template authors could inject php code by choosing a malicious {block} name or {include} file name. (CVE-2022-29221)

Record
MGASA-2022-0226
Updated
2026-11-02
OSVUSN-6012-1 No score

smarty3 vulnerability

It was discovered that Smarty incorrectly parsed blocks' names and included files' names. A remote attacker with template writing permissions could use this issue to execute arbitrary PHP code. (CVE-2022-29221)

Record
USN-6012-1
Updated
2026-11-02
OSVUSN-6550-1 No score

postfixadmin vulnerabilities

It was discovered that Smarty, that is integrated in the PostfixAdmin code, was not properly sanitizing user input when generating templates. An attacker could, through PHP injection, possibly use this issue to execute arbitrary code. (CVE-2022-29221)

It was discovered that Moment.js, that is integrated in the PostfixAdmin code, was using an inefficient parsing algorithm when processing date strings in the RFC 2822 standard. An attacker could possibly use this issue to cause a denial of service. This issue only affected Ubuntu 22.04 LTS. (CVE-2022-31129)

It was discovered that Smarty, that is integrated in the PostfixAdmin code, was not properly escaping JavaScript code. An attacker could possibly use this issue to conduct cross-site scripting attacks (XSS). (CVE-2023-28447)

Record
USN-6550-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
smarty/smarty
Packagist
before 3.1.45
3.1.45
smarty/smarty
Packagist
4.0.0 up to 4.1.1
4.1.1
smarty3
Debian:12
before 3.1.45-1
3.1.45-1
smarty3
Debian:13
before 3.1.45-1
3.1.45-1
smarty3
Debian:14
before 3.1.45-1
3.1.45-1
smarty4
Debian:12
before 4.1.1-1
4.1.1-1
smarty4
Debian:13
before 4.1.1-1
4.1.1-1
smarty4
Debian:14
before 4.1.1-1
4.1.1-1
smarty3
Debian:9
before 3.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u6, plus listed versions
3.1.31+20161214.1.c7d42e4+selfpack1-23.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u13.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u23.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u33.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u43.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u5
3.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u6
smarty3
Debian:10
From an advisory covering 3 CVEs
before 3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1, plus listed versions
3.1.33+20180830.1.3a78a21f+selfpack1-1
3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1
Show 24 moreShow less
Affected packages
PackageAffectedFixed
smarty3
Debian:11
From an advisory covering 3 CVEs
before 3.1.39-2+deb11u1, plus listed versions
3.1.39-13.1.39-2
3.1.39-2+deb11u1
smarty/smarty
Packagist
before 3.1.45, plus listed versions
v2.6.24v2.6.25v2.6.26v2.6.27v2.6.28
Show 38 moreShow less
v2.6.29v2.6.30v2.6.31v2.6.33v3.1.11v3.1.12v3.1.13v3.1.14v3.1.15v3.1.16v3.1.17v3.1.18v3.1.19v3.1.20v3.1.21v3.1.23v3.1.24v3.1.25v3.1.26v3.1.27v3.1.28v3.1.29v3.1.30v3.1.31v3.1.32v3.1.33v3.1.34v3.1.35v3.1.36v3.1.37v3.1.37.1v3.1.38v3.1.39v3.1.40v3.1.41v3.1.42v3.1.43v3.1.44
3.1.45
smarty/smarty
Packagist
4.0.0 up to 4.1.1, plus listed versions
v4.0.0v4.0.1v4.0.2v4.0.3v4.0.4v4.1.0
4.1.1
php-smarty
Mageia:8
before 4.1.1-1.mga8
4.1.1-1.mga8
collabtive
Ubuntu:16.04:LTS
All versions, plus listed versions
2.0+dfsg-62.0+dfsg-6ubuntu12.0+dfsg-6ubuntu1.1
None known
galette
Ubuntu:16.04:LTS
All versions, plus listed versions
0.8+dfsg-10.8+dfsg-1ubuntu1
None known
gosa
Ubuntu:16.04:LTS
All versions, plus listed versions
2.7.4+reloaded2-22.7.4+reloaded2-52.7.4+reloaded2-62.7.4+reloaded2-72.7.4+reloaded2-82.7.4+reloaded2-92.7.4+reloaded2-9ubuntu12.7.4+reloaded2-9ubuntu1.1
None known
smarty3
Ubuntu:Pro:16.04:LTS
All versions, plus listed versions
3.1.21-13.1.21-1ubuntu13.1.21-1ubuntu1+esm13.1.21-1ubuntu1+esm2
None known
gosa
Ubuntu:18.04:LTS
All versions, plus listed versions
2.7.4+reloaded2-13ubuntu12.7.4+reloaded3-2ubuntu12.7.4+reloaded3-3
None known
postfixadmin
Ubuntu:Pro:18.04:LTS
before 3.0.2-2ubuntu0.1~esm1, plus listed versions
3.0.2-2
3.0.2-2ubuntu0.1~esm1
smarty3
Ubuntu:Pro:18.04:LTS
All versions, plus listed versions
3.1.31+20161214.1.c7d42e4+selfpack1-23.1.31+20161214.1.c7d42e4+selfpack1-33.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.13.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1+esm1
None known
gosa
Ubuntu:20.04:LTS
All versions, plus listed versions
2.7.4+reloaded3-102.7.4+reloaded3-10ubuntu12.7.4+reloaded3-11
None known
postfixadmin
Ubuntu:Pro:20.04:LTS
before 3.2.1-3ubuntu0.1~esm1, plus listed versions
3.2.1-23.2.1-3
3.2.1-3ubuntu0.1~esm1
smarty3
Ubuntu:Pro:20.04:LTS
All versions, plus listed versions
3.1.33+20180830.1.3a78a21f+selfpack1-13.1.34+20190228.1.c9f0de05+selfpack1-13.1.34+20190228.1.c9f0de05+selfpack1-1ubuntu0.1~esm13.1.34+20190228.1.c9f0de05+selfpack1-1ubuntu0.13.1.34+20190228.1.c9f0de05+selfpack1-1ubuntu0.1+esm1
None known
gosa
Ubuntu:22.04:LTS
All versions, plus listed versions
2.7.4+reloaded3-16build1
None known
smarty3
Ubuntu:22.04:LTS
before 3.1.39-2ubuntu1.22.04.1, plus listed versions
3.1.39-23.1.39-2ubuntu1
3.1.39-2ubuntu1.22.04.1
postfixadmin
Ubuntu:Pro:22.04:LTS
before 3.3.10-2ubuntu0.1~esm1, plus listed versions
3.3.7-13.3.10-2
3.3.10-2ubuntu0.1~esm1
gosa
Ubuntu:24.04:LTS
All versions, plus listed versions
2.8~git20230203.10abe45+dfsg-82.8~git20230203.10abe45+dfsg-92.8~git20230203.10abe45+dfsg-102.8~git20230203.10abe45+dfsg-11
None known
gosa
Ubuntu:25.10
All versions, plus listed versions
2.8~git20230203.10abe45+dfsg-182.8~git20230203.10abe45+dfsg-19
None known
gosa
Ubuntu:26.10
All versions, plus listed versions
2.8~git20230203.10abe45+dfsg-19
None known
gosa
Ubuntu:26.04:LTS
All versions, plus listed versions
2.8~git20230203.10abe45+dfsg-19
None known
postfixadmin
Ubuntu:Pro:18.04:LTS
From an advisory covering 3 CVEs
before 3.0.2-2ubuntu0.1~esm1, plus listed versions
3.0.2-2
3.0.2-2ubuntu0.1~esm1
postfixadmin
Ubuntu:Pro:20.04:LTS
From an advisory covering 3 CVEs
before 3.2.1-3ubuntu0.1~esm1, plus listed versions
3.2.1-23.2.1-3
3.2.1-3ubuntu0.1~esm1
postfixadmin
Ubuntu:Pro:22.04:LTS
From an advisory covering 3 CVEs
before 3.3.10-2ubuntu0.1~esm1, plus listed versions
3.3.7-13.3.10-2
3.3.10-2ubuntu0.1~esm1

Public exploits

Links only. Every CVE stores no exploit code.

Public exploits
SourceLinkDate
PoC in GitHubsbani/CVE-2022-29221-PoC2022-05-25

History

History
RecordedChangedSources
affected, factsOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV, PoC in GitHub

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2022-29221 is a high vulnerability (CVSS 8.8) in Smarty, published May 24, 2022. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 4.91%, the 92nd percentile. Fixed in smarty/smarty 3.1.45.

References

Show 20 moreShow less
MoveEnter Open