Access to restricted PHP code by dynamic static class access in smarty
Priority MEDIUM 44CWE-20Published · Updated
Key facts
- Attack vector
- Network
- Privileges required
- Low
- User interaction
- None
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.
Summary
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Prior to versions 3.1.43 and 4.0.3, template authors could run restricted static php methods. Users should upgrade to version 3.1.43 or 4.0.3 to receive a patch.
Why it matters now
Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.02143 82nd percentileScored 2026-11-07
Fix Fixed smarty (smarty-php): 3.1.43, 4.0.3smarty/smarty (Packagist): 3.1.43, 4.0.3
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| smarty-php | smarty | before 3.1.43; 4.0.0 to before 4.0.3 | 3.1.43, 4.0.3 | Patch available | CNA |
| — | smarty/smarty (Packagist) | before 3.1.43 | 3.1.43 | Patch available | GHSA-4h9c-v5vg-5m6m |
| — | smarty/smarty (Packagist) | 4.0.0 to before 4.0.3 | 4.0.3 | Patch available | GHSA-4h9c-v5vg-5m6m |
- smarty Vendorsmarty-php Affected before 3.1.43; 4.0.0 to before 4.0.3 Fixed in 3.1.43, 4.0.3 Patch available CNA
- smarty/smarty (Packagist) Vendor— Affected before 3.1.43 Fixed in 3.1.43 Patch available GHSA-4h9c-v5vg-5m6m
- smarty/smarty (Packagist) Vendor— Affected 4.0.0 to before 4.0.3 Fixed in 4.0.3 Patch available GHSA-4h9c-v5vg-5m6m
CPE configurations NVD · 6
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:smarty:smarty:*:*:*:*:*:*:*:* | before 3.1.43; 4.0.0 to before 4.0.3 | Vulnerable | smarty-php |
| cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:* | 9.0 | Vulnerable | Debian |
| cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* | 10.0 | Vulnerable | Debian |
| cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* | 11.0 | Vulnerable | Debian |
| cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* | 36 | Vulnerable | Fedoraproject |
| cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:* | 37 | Vulnerable | Fedoraproject |
- cpe:2.3:a:smarty:smarty:*:*:*:*:*:*:*:* Versions before 3.1.43; 4.0.0 to before 4.0.3 Vulnerable ·smarty-php
- cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:* Versions 9.0 Vulnerable ·Debian
- cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* Versions 10.0 Vulnerable ·Debian
- cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* Versions 11.0 Vulnerable ·Debian
- cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* Versions 36 Vulnerable ·Fedoraproject
- cpe:2.3:o:fedoraproject:fedora:37:*:*:*:*:*:*:* Versions 37 Vulnerable ·Fedoraproject
Remediation
- Fix · CNA smarty (smarty-php) Fixed in 3.1.43, 4.0.3
- Fix · GHSA-4h9c-v5vg-5m6m smarty/smarty (Packagist) Fixed in 3.1.43 Advisory →
- Fix · GHSA-4h9c-v5vg-5m6m smarty/smarty (Packagist) Fixed in 4.0.3 Advisory →
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2021-21408
- 2026-10-03 Alias added: GHSA-4h9c-v5vg-5m6m
References
Advisory 9
- https://github.com/smarty-php/smarty/security/advisories/GHSA-4h9c-v5vg-5m6m
- https://github.com/smarty-php/smarty/releases/tag/v3.1.43
- https://github.com/smarty-php/smarty/releases/tag/v4.0.3
- [debian-lts-announce] 20220505 [SECURITY] [DLA 2995-1] smarty3 security update
- DSA-5151
- GLSA-202209-09
- FEDORA-2022-52154efd61
- FEDORA-2022-d5fc9dcdd7
- https://nvd.nist.gov/vuln/detail/CVE-2021-21408
Other 4
- https://github.com/FriendsOfPHP/security-advisories/blob/master/smarty/smarty/CVE-2021-21408.yaml
- https://github.com/smarty-php/smarty
- https://lists.fedoraproject.org/archives/list/[email protected]/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ
- https://lists.fedoraproject.org/archives/list/[email protected]/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI
More smarty-php Smarty vulnerabilities
- TI-2021-08070 Smarty before 3.1.39 allows code injection via an unexpected function name after a {function name= substring. CVSS 3.1CRITICAL 9.8
- TI-2009-01585 The smarty_function_math function in libs/plugins/function.math.php in Smarty 2.6.22… CVSS 2.0HIGH 10.0
- TI-2006-06846 PHP remote file inclusion vulnerability in libs/Smarty.class.php in Smarty 2.6.9 allows… CVSS 3.1CRITICAL 9.8
- TI-2022-11764 PHP Code Injection by malicious block or filename in Smarty CVSS 3.1HIGH 8.8
- TI-2017-14689 Smarty 3 before 3.1.32 is vulnerable to a PHP code injection when calling fetch() or… CVSS 3.0CRITICAL 9.8
- TI-2010-04450 Smarty before 3.0.0 beta 7 does not properly handle the <?php and ?> tags, which has… CVSS 2.0HIGH 10.0
Sources
- CVE-2021-21408 · CVE Program
- CVE-2021-21408 · NVD
- FIRST EPSS
- GHSA-4h9c-v5vg-5m6m · GitHub Advisory Database · CC BY 4.0
- CVE-2021-21408 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences