CVE-2021-21408: Access to restricted PHP code by dynamic static class access in smarty
Noroxi assessment
Priority: Monitor (action score 36/100)
- The sources we track (CISA KEV, Exploit-DB, Metasploit, Nuclei, GitHub) show no public exploit code or exploitation in the wild.
- Probability of exploitation in the next 30 days: 2.1% (FIRST EPSS); higher than 82.3% of all records.
- Anyone who can reach it over the internet can trigger it. A low-privileged account is enough. No user action is required. No special conditions are required; it is repeatable.
- Fixed version: smarty-php smarty 3.1.43.
Low priority for now. Upgrade to smarty-php smarty 3.1.43 or later.
Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it
Primary sources: NVD · CVE.org · FIRST EPSS
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.
- Published
- Jan 10, 2022
- Updated
- Jun 16, 2026
- EPSS
- 2.1% · 82th percentile
- CWE
- CWE-20
Report tools
Action score
36
Low priority for now.
- CVSS
- 35 / 40 · 8.8 / 10
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 1 / 30 · 2.1%
CISA SSVC decision
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
Vulnrichment: CISA's decision-tree inputs.
CNA vs NVD score
- NVD
- 8.8
- CNA · GitHub_M
- 8.8
- agree
The score given by the assigning authority versus NVD’s independent score. A gap means the severity is contested.
Get told when this record changes
- Not in KEV: no record of exploitation in the wild
- No public exploit code on record
- A fix has been released
If any of these changes, we'll tell you in the daily email digest.
Is your version affected? Check itNoroxi analysis
What does it mean in your environment?
The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.
We use this product, ask for helpAffected systems
Is your version affected?
Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.
| Vendor | Product | CPE |
|---|---|---|
| smarty | smarty | cpe:2.3:a:smarty:smarty |
| debian | debian linux | cpe:2.3:o:debian:debian_linux |
| fedoraproject | fedora | cpe:2.3:o:fedoraproject:fedora |
Affected versions
NVD version ranges (for catalog products). Add the product to your stack with a version and matching uses these.
- debian debian linux10.0
- debian debian linux11.0
- debian debian linux9.0
- fedoraproject fedora36
- fedoraproject fedora37
- smarty smarty4.0.0 and later · before 4.0.3
- smarty smartybefore 3.1.43
Versions reported by the vendor
Affected version ranges reported by the assigning authority (GitHub_M). Independent of NVD's CPE analysis and usually ahead of it.
smarty-php smarty
- < 3.1.43, >= 4.0.0, < 4.0.3affected
Package-level exposure
OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| Debian:10 | smarty3 | before 3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1 | 3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1 |
| Debian:11 | smarty3 | before 3.1.39-2+deb11u1 | 3.1.39-2+deb11u1 |
| Debian:12 | smarty3 | before 3.1.45-1 | 3.1.45-1 |
| Debian:12 | smarty4 | before 4.1.1-1 | 4.1.1-1 |
| Debian:9 | smarty3 | before 3.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u5 | 3.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u5 |
| Packagist | smarty/smarty | from 4.0.0 · before 4.0.3 | 4.0.3 |
| Packagist | smarty/smarty | before 3.1.43 | 3.1.43 |
Same product
smarty: all recordsOther highest-scoring records for the same primary product.
- CVE-2021-26120Smarty before 3.1.39 allows code injection via an unexpected function name after a {function name= substring.64This week
- CVE-2009-1669The smarty_function_math function in libs/plugins/function.math.php in Smarty 2.6.22 allows context-dependent attackers to execute…44Plan
- CVE-2010-4727Smarty before 3.0.0 beta 7 does not properly handle the <?php and ?> tags, which has unspecified impact and remote attack vectors.41Plan
Published before and after this one in the same product
- ← EarlierCVE-2011-1028Nov 20, 2019 · The $smarty.template variable in Smarty3 allows attackers to possibly execute arbitrary PHP code via the…39Monitor
- ← EarlierCVE-2021-26119Feb 21, 2021 · Smarty before 3.1.39 allows a Sandbox Escape because $smarty.template_object can be accessed in sandbox mode.33Monitor
- Later →CVE-2021-29454Jan 10, 2022 · Sandbox Escape by math function in smarty36Monitor
Remediation
Which version to upgrade to
Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.
| Product / package | Fixed version | Source |
|---|---|---|
| smarty-php smarty | 3.1.43 · description | Vendor (CNA) |
| debian:smarty3 | 3.1.45-1 · Debian:12 | Package registry (OSV) |
| debian:smarty4 | 4.1.1-1 · Debian:12 | Package registry (OSV) |
| Packagist:smarty/smarty | 3.1.43 | Package registry (OSV) |
| Packagist:smarty/smarty | 4.0.3 | Package registry (OSV) |
Exploit status
No known public exploit
No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.
Research context
For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.
Timeline
From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.
No dated events beyond publication.
No history yet (it accumulates with the daily EPSS job).
Patch and commit links
Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.
Credits
All researchersFinders, reporters and analysts named in the CNA record. Click a name for that researcher’s other records.
No credits in the CNA record.
Variant candidates
Same product, same weakness class, within 18 months. If the patch missed the root cause, the sibling bug is here.
No nightly-computed relations.
Chain candidates
An authentication bypass and a privilege-requiring bug in the same product, published close together: combined they may become an unauthenticated path.
—
Bug bounty scope
No known public program.
Source: bounty-targets-data (public HackerOne, Bugcrowd, Intigriti, YesWeHack listings).
Technical details
Attack conditions
- Anyone who can reach it over the internet can trigger it.
- A low-privileged account is enough.
- No user action is required.
- No special conditions are required; it is repeatable.
If successful
- Confidentiality
- high · data can be read
- Integrity
- high · data or configuration can be modified
- Availability
- high · the service can be disrupted
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality impact
- High
- Integrity impact
- High
- Availability impact
- High
Weakness class (CWE)
CWE-20 · Improper Input ValidationCVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
nvd-primary
Attack context
MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.
Attack patterns (CAPEC)
- Buffer Overflow via Environment VariablesCAPEC-10likelihood: High · High
- Server Side Include (SSI) InjectionCAPEC-101likelihood: High · High
- Cross Zone ScriptingCAPEC-104likelihood: Medium · High
- Command Line Execution through SQL InjectionCAPEC-108likelihood: Low · Very High
- Object Relational Mapping InjectionCAPEC-109likelihood: Low · High
- SQL Injection through SOAP Parameter TamperingCAPEC-110likelihood: High · Very High
- Double EncodingCAPEC-120likelihood: Low · Medium
- Subverting Environment Variable ValuesCAPEC-13likelihood: High · Very High
ATT&CK techniques
- Obfuscated Files or InformationT1027
- Masquerading: Invalid Code SignatureT1036.001
- Steal Web Session CookieT1539
- Subvert Trust Controls: Code SigningT1553.002
- Impair Defenses:Impair Command History LoggingT1562.003
- Hijack Execution Flow:Dynamic Linker HijackingT1574.006
- Hijack Execution Flow:Path Interception by PATH Environment VariableT1574.007
Change log
- Fix✗ → ✓
For records you follow, these changes also arrive as notifications. →
References
Show all references (8 more)Show less
- github.com/smarty-php/smarty/releases/tag/v3.1.43
- github.com/smarty-php/smarty/releases/tag/v4.0.3
- github.com/smarty-php/smarty/security/advisories/GHSA-4h9c-v5vg-5m6m
- lists.debian.org/debian-lts-announce/2022/05/msg00005.html
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BRAJVDRGCIY5UZ2PQHKDTT7RMKG6WJQQ/
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L777JIBIWJV34HS7LXPIDWASG7TT4LNI/
- security.gentoo.org/glsa/202209-09
- www.debian.org/security/2022/dsa-5151
Vendor advisories and official records. Exploit/PoC links are deliberately left out.