Medium

Smarty: Symlink path traversal out of trusted directories

  • Disclosed: 07.08.2026
  • Updated: 11.10.2026 10:22

When Smarty's Security policy is enabled, secure_dir (and the configured template/trusted directories) restrict which local files a template may read via {include} and {fetch}. The trust check in Security::_checkDir() resolved the requested path with Smarty::_realpath(), which normalizes the path as a string only and does not follow symbolic links. A symlink placed inside a trusted directory therefore passed the trust check, while the underlying file_get_contents() followed it to an arbitrary file outside the sandbox (e.g. /etc/passwd).

Impact

An attacker able to (a) cause a symlink to exist inside a trusted directory (e.g. a user-upload area located within the template path) and (b) cause a template to reference that path can read arbitrary files readable by the PHP process, escaping the secure_dir boundary. Confidentiality impact only.

Patches

Fixed in 5.8.2. Security::_checkDir() now resolves the requested file with native realpath() and re-validates the canonical, symlink-free path against the trusted directories (which are canonicalized the same way, so legitimate symlinked deployment paths such as a Capistrano current symlink or macOS /var → /private/var keep working). It falls back to string normalization only when the file does not yet exist on disk.

Workarounds

Ensure no untrusted symlinks can be created within any directory listed in secure_dir/the trusted template directories; restrict write access to those directories to trusted processes only.

References

  • Fix commit: 99c048c
  • CWE-22

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Composer package smarty/smarty >= 5.0.0, < 5.8.2, < 4.5.7 5.8.2, 4.5.7

References

CVSS score -
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Weakness (CWE)
CWE-22, CWE-61
Platform
Composer
Package
smarty/smarty
Disclosed
07.08.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-f6wf-28g6-769x - CC BY 4.0

Vulnerability history: smarty/smarty

All published vulnerabilities of this package (Composer package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (18) in the archive
Total entries
18
First → latest
02.2021 09.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 3
  • High 8
  • Medium 7

Disclosures per year

  1. 2021: 2
  2. 2022: 11
  3. 2023: 1
  4. 2024: 1
  5. 2025: 0
  6. 2026: 3
Severity:
  1. Smarty: Symlink path traversal out of trusted directories this entry
    Medium CVE-2026-62992 >= 5.0.0, < 5.8.2, < 4.5.7 5.8.2, 4.5.7
  2. High · 7.3 CVE-2024-35226 >= 5.0.0, < 5.1.1, >= 3.0.0, < 4.5.3 5.1.1, 4.5.3
  3. High · 7.1 CVE-2023-28447 >= 4.0.0, < 4.3.1, < 3.1.48 4.3.1, 3.1.48
  4. High · 8.8 CVE-2022-29221 < 3.1.45, >= 4.0.0, < 4.1.1 3.1.45, 4.1.1
  5. High CVE-2014-8350 < 3.1.21 3.1.21
  6. Critical · 9.8 CVE-2017-1000480 >= 3, < 3.1.32 3.1.32
  7. High · 7.5 CVE-2018-13982 < 3.1.33 3.1.33
  8. Critical · 9.8 CVE-2011-1028 < 3.0.7 3.0.7
  9. High · 8.8 CVE-2021-21408 < 3.1.43, >= 4.0.0, < 4.0.3 3.1.43, 4.0.3
  10. High · 8.1 CVE-2021-29454 < 3.1.42, >= 4.0.0, < 4.0.2 3.1.42, 4.0.2
  11. High · 7.5 CVE-2021-26119 < 3.1.39 3.1.39
  12. Critical · 9.8 CVE-2021-26120 < 3.1.39 3.1.39

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.