CVE-2021-29454: Sandbox Escape by math function 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: 1.8% (FIRST EPSS); higher than 79.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.42.
Low priority for now. Upgrade to smarty-php smarty 3.1.42 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.42 and 4.0.2, template authors could run arbitrary PHP code by crafting a malicious math string. If a math string was passed through as user provided data to the math function, external users could run arbitrary PHP code by crafting a malicious math string. Users should upgrade to version 3.1.42 or 4.0.2 to receive a patch.
- Published
- Jan 10, 2022
- Updated
- Jun 16, 2026
- EPSS
- 1.8% · 79th percentile
- CWE
- CWE-74
Report tools
Action score
36
Monitor
Low priority for now.
- CVSS
- 35 / 40 · 8.8 / 10
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 1 / 30 · 1.8%
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.1
- 0.7 point gap
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
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.
Running WordPress? Scan your site free with WP Lens
Noroxi 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.2
- smarty smartybefore 3.1.42
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.42, >= 4.0.0, < 4.0.2affected
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.2 | 4.0.2 |
| Packagist | smarty/smarty | before 3.1.42 | 3.1.42 |
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 arbitrary44Plan
- 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-2021-26119Feb 21, 2021 · Smarty before 3.1.39 allows a Sandbox Escape because $smarty.template_object can be accessed in sandbox mode.33Monitor
- ← EarlierCVE-2021-21408Jan 10, 2022 · Access to restricted PHP code by dynamic static class access in smarty36Monitor
- Later →CVE-2022-29221May 24, 2022 · PHP Code Injection by malicious block or filename 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.42 · 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.42 | Package registry (OSV) |
| Packagist:smarty/smarty | 4.0.2 | 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-74 · Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')CVSS 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
- HTTP Request SplittingCAPEC-105likelihood: Medium · High
- Command Line Execution through SQL InjectionCAPEC-108likelihood: Low · Very High
- Double EncodingCAPEC-120likelihood: Low · Medium
- Subverting Environment Variable ValuesCAPEC-13likelihood: High · Very High
- Format String InjectionCAPEC-135likelihood: High · High
- Client-side Injection-induced Buffer OverflowCAPEC-14likelihood: Medium · High
Change log
- Fix✗ → ✓
For records you follow, these changes also arrive as notifications. →
References
Show all references (10 more)Show less
- github.com/smarty-php/smarty/releases/tag/v3.1.42
- github.com/smarty-php/smarty/releases/tag/v4.0.2
- github.com/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m
- 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/
- packagist.org/packages/smarty/smarty
- security.gentoo.org/glsa/202209-09
- www.debian.org/security/2022/dsa-5151
- www.smarty.net/docs/en/language.function.math.tpl
Vendor advisories and official records. Exploit/PoC links are deliberately left out.