Description
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Prior to 5.8.2 (and 4.5.7 on the 4.x line), Security::_checkDir() does not fully resolve symbolic links before validating that a requested path lies within a configured secure directory. An attacker able to place or reference a symlink within a directory Smarty treats as trusted (e.g., a template or config directory) could use it to point outside the intended secure directory, bypassing the containment check and reading arbitrary files accessible to the PHP process. This issue is fixed in versions 5.8.2 and 4.5.7.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| smarty-php | smarty | >= 5.0.0, < 5.8.2, < 4.5.7 | — |
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 | No fix yet | — |
| Debian 14 | smarty4 | 4.5.8-1 | — |
| Debian 13 | smarty3 +1 | No fix yet | — |
| Debian 12 | smarty3 +1 | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | smarty3 +1 | No fix yet | — |
| Ubuntu 26.04 LTS | smarty3 +1 | No fix yet | — |
| Ubuntu 24.04 LTS | smarty3 +1 | No fix yet | — |
| Ubuntu 22.04 LTS | smarty3 | No fix yet | — |
Show 3 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 20.04 LTS | smarty3 | No fix yet | — |
| Ubuntu Pro 18.04 LTS | smarty3 | No fix yet | — |
| Ubuntu Pro 16.04 LTS | smarty3 | No fix yet | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| Packagist | smarty/smarty | >= 5.0.0, < 5.8.2 | 5.8.2 | GHSA-f6wf-28g6-769x |
| Packagist | smarty/smarty | < 4.5.7 | 4.5.7 | GHSA-f6wf-28g6-769x |
References
- https://github.com/smarty-php/smarty/security/advisories/GHSA-f6wf-28g6-769x
- https://github.com/smarty-php/smarty/commit/99c048ce7a590c519b79fbd38ad0143a08183a1f
- https://github.com/smarty-php/smarty/commit/a1ccdb0518021a559b4066c37b76a42c86bbce90
- https://github.com/smarty-php/smarty/releases/tag/v4.5.7
- https://github.com/smarty-php/smarty/releases/tag/v5.8.2