Description
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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| smarty-php | smarty | < 3.1.42, >= 4.0.0, < 4.0.2 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | smarty3 | 3.1.45-1 | — |
| Debian 14 | smarty4 | 4.1.1-1 | — |
| Debian 13 | smarty3 | 3.1.45-1 | — |
| Debian 13 | smarty4 | 4.1.1-1 | — |
| Debian 12 | smarty3 | 3.1.45-1 | — |
| Debian 12 | smarty4 | 4.1.1-1 | — |
| Debian 11 | smarty3 | 3.1.39-2+deb11u1 | DSA-5151-1 |
| Debian 10 | smarty3 | 3.1.33+20180830.1.3a78a21f+selfpack1-1+deb10u1 | DSA-5151-1 |
Show 1 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 9 | smarty3 | 3.1.31+20161214.1.c7d42e4+selfpack1-2+deb9u5 | DLA-2995-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 22.04 LTS | smarty3 | 3.1.39-2ubuntu1 | — |
| Ubuntu 18.04 LTS | smarty3 | 3.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1 | USN-5348-1 |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 20.04 LTS | smarty3 | 3.1.34+20190228.1.c9f0de05+selfpack1-1ubuntu0.1~esm1 | USN-5348-3 |
| Ubuntu Pro 16.04 LTS | smarty3 | 3.1.21-1ubuntu1+esm1 | USN-5348-2 |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| Packagist | smarty/smarty | < 3.1.42 | 3.1.42 | GHSA-29gp-2c3m-3j6m |
| Packagist | smarty/smarty | >= 4.0.0, < 4.0.2 | 4.0.2 | GHSA-29gp-2c3m-3j6m |
Advisories 5
- USN-5348-2 smarty3 vulnerabilities Ubuntu Security Notices (USN) · Jun 25, 2026
- DSA-5151-1 smarty3 - security update Debian Security (DSA / DLA) · Mar 9, 2026
- DLA-2995-1 smarty3 - security update Debian Security (DSA / DLA) · Mar 9, 2026
- USN-5348-1 smarty3 vulnerabilities Ubuntu Security Notices (USN) · Feb 10, 2026
- USN-5348-3 smarty3 vulnerabilities Ubuntu Security Notices (USN) · Feb 10, 2026
References
- https://github.com/smarty-php/smarty/security/advisories/GHSA-29gp-2c3m-3j6m
- https://github.com/smarty-php/smarty/commit/215d81a9fa3cd63d82fb3ab56ecaf97cf1e7db71
- https://github.com/smarty-php/smarty/releases/tag/v3.1.42
- https://github.com/smarty-php/smarty/releases/tag/v4.0.2
- https://packagist.org/packages/smarty/smarty
- https://www.smarty.net/docs/en/language.function.math.tpl
- [debian-lts-announce] 20220505 [SECURITY] [DLA 2995-1] smarty3 security update mailing-list
- DSA-5151 vendor-advisory
- GLSA-202209-09 vendor-advisory
- FEDORA-2022-52154efd61 vendor-advisory
- FEDORA-2022-d5fc9dcdd7 vendor-advisory