CVE-2022-29221
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.
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
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 High
CVSS: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 High
CVSS: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:
- Open an issue in the Smarty repo
- Record
GHSA-634x-pc3q-cf4c- CVSS 3.1
- 8.8 High
CVSS: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 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 6.5 Medium
AV: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 High
CVSS: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 High
CVSS: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:
- Open an issue in the Smarty repo
- Record
GHSA-634x-pc3q-cf4c- CVSS 3.1
- 8.8 High
CVSS: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 High
CVSS: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
| Package | Affected | Fixed |
|---|---|---|
smarty/smartyPackagist |
before 3.1.45 | 3.1.45 |
smarty/smartyPackagist |
4.0.0 up to 4.1.1 | 4.1.1 |
smarty3Debian:12 |
before 3.1.45-1 | 3.1.45-1 |
smarty3Debian:13 |
before 3.1.45-1 | 3.1.45-1 |
smarty3Debian:14 |
before 3.1.45-1 | 3.1.45-1 |
smarty4Debian:12 |
before 4.1.1-1 | 4.1.1-1 |
smarty4Debian:13 |
before 4.1.1-1 | 4.1.1-1 |
smarty4Debian:14 |
before 4.1.1-1 | 4.1.1-1 |
smarty3Debian: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 |
smarty3Debian: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
| Package | Affected | Fixed |
|---|---|---|
smarty3Debian: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/smartyPackagist |
before 3.1.45, plus listed versions v2.6.24v2.6.25v2.6.26v2.6.27v2.6.28 Show 38 moreShow lessv2.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/smartyPackagist |
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-smartyMageia:8 |
before 4.1.1-1.mga8 | 4.1.1-1.mga8 |
collabtiveUbuntu:16.04:LTS |
All versions, plus listed versions 2.0+dfsg-62.0+dfsg-6ubuntu12.0+dfsg-6ubuntu1.1 |
None known |
galetteUbuntu:16.04:LTS |
All versions, plus listed versions 0.8+dfsg-10.8+dfsg-1ubuntu1 |
None known |
gosaUbuntu: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 |
smarty3Ubuntu: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 |
gosaUbuntu:18.04:LTS |
All versions, plus listed versions 2.7.4+reloaded2-13ubuntu12.7.4+reloaded3-2ubuntu12.7.4+reloaded3-3 |
None known |
postfixadminUbuntu:Pro:18.04:LTS |
before 3.0.2-2ubuntu0.1~esm1, plus listed versions 3.0.2-2 |
3.0.2-2ubuntu0.1~esm1 |
smarty3Ubuntu: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 |
gosaUbuntu:20.04:LTS |
All versions, plus listed versions 2.7.4+reloaded3-102.7.4+reloaded3-10ubuntu12.7.4+reloaded3-11 |
None known |
postfixadminUbuntu: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 |
smarty3Ubuntu: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 |
gosaUbuntu:22.04:LTS |
All versions, plus listed versions 2.7.4+reloaded3-16build1 |
None known |
smarty3Ubuntu: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 |
postfixadminUbuntu: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 |
gosaUbuntu: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 |
gosaUbuntu:25.10 |
All versions, plus listed versions 2.8~git20230203.10abe45+dfsg-182.8~git20230203.10abe45+dfsg-19 |
None known |
gosaUbuntu:26.10 |
All versions, plus listed versions 2.8~git20230203.10abe45+dfsg-19 |
None known |
gosaUbuntu:26.04:LTS |
All versions, plus listed versions 2.8~git20230203.10abe45+dfsg-19 |
None known |
postfixadminUbuntu: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 |
postfixadminUbuntu: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 |
postfixadminUbuntu: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.
| Source | Link | Date |
|---|---|---|
| PoC in GitHub | sbani/CVE-2022-29221-PoC | 2022-05-25 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | OSV | |
| first indexed | CVE 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
github.com/smarty-php/smarty/security/advisories/GHSA-634x-pc3q-cf4c
github.com/smarty-php/smarty/commit/64ad6442ca1da31cefdab5c9874262b702cccddd
github.com/smarty-php/smarty/releases/tag/v3.1.45
github.com/smarty-php/smarty/releases/tag/v4.1.1
lists.debian.org/debian-lts-announce/2022/05/msg00044.html
debian.org/security/2022/dsa-5151
Show 20 moreShow less
security.gentoo.org/glsa/202209-09
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ
nvd.nist.gov/vuln/detail/CVE-2022-29221
github.com/FriendsOfPHP/security-advisories/blob/master/smarty/smarty/CVE-2022-29221.yaml
lists.fedoraproject.org/archives/list/[email protected]/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI
lists.fedoraproject.org/archives/list/[email protected]/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ
github.com/advisories/GHSA-634x-pc3q-cf4c
github.com/CVEProject/cvelistV5/tree/main/cves/2022/29xxx/CVE-2022-29221.json
security-tracker.debian.org/tracker/CVE-2022-29221
github.com/smarty-php/smarty
advisories.mageia.org/MGASA-2022-0226.html
bugs.mageia.org/show_bug.cgi?id=30495
ubuntu.com/security/CVE-2022-29221
github.com/smarty-php/smarty/commit/3606c4717ed6348e114a610ff1e446048dcd0345
ubuntu.com/security/notices/USN-6012-1
ubuntu.com/security/notices/USN-6550-1
cve.org/CVERecord?id=CVE-2022-29221
ubuntu.com/security/CVE-2022-31129
ubuntu.com/security/CVE-2023-28447