CVE-2026-62992: Smarty Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-f6wf-28g6-769x
CWE-61 CWE-22
Published
Advisory Summary

CVE-2026-62992 is a MODERATE path traversal vulnerability (CWE-61: UNIX Symbolic Link (Symlink) Following) affecting Smarty libraries in the Packagist ecosystem. The issue involves symlink path traversal out of trusted directories. Remediation is available by upgrading affected packages to version 5.8.2, 4.5.7.

CVE-2026-62992 at a Glance

CVE Identifier CVE-2026-62992
GHSA Identifier GHSA-f6wf-28g6-769x
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-61: UNIX Symbolic Link (Symlink) Following
Affected Product Smarty
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-62992

To remediate this vulnerability, upgrade all affected Smarty dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

smarty/smarty fixed: 5.8.2
Upgrade smarty/smarty to 5.8.2
smarty/smarty fixed: 4.5.7
Upgrade smarty/smarty to 4.5.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for smarty/smarty

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-62992, inspect your project dependencies for Smarty:

inspect dependencies for smarty/smarty

Analyze the terminal output to locate any version of Smarty in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.8.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-61: UNIX Symbolic Link (Symlink) Following, where the product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. this could allow an attacker to cause the product to operate on unauthorized files. In Smarty, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2026-62992 Affected Smarty Versions

2 component(s)
Fixed Versions:
5.8.24.5.7
Product / Package Ecosystem Affected Versions Fixed Version
smarty/smarty
Packagist
≥ 5.0.0
< 5.8.2
5.8.2
smarty/smarty
Packagist
< 4.5.7
4.5.7

References

Frequently Asked Questions

What is CVE-2026-62992?
CVE-2026-62992 is a security vulnerability in Smarty involving Symlink path traversal out of trusted directories under CWE-61: UNIX Symbolic Link (Symlink) Following.
Which Smarty versions are affected?
Affected versions include releases prior to 5.8.2, 4.5.7 across affected packages: smarty/smarty.
What version fixes CVE-2026-62992?
Upgrading to 5.8.2, 4.5.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is smarty/smarty affected?
Yes, smarty/smarty is affected in releases prior to 5.8.2, 4.5.7. Upgrade your dependency to 5.8.2, 4.5.7 or later.
What CWE is associated with CVE-2026-62992?
CVE-2026-62992 is classified under CWE-61: UNIX Symbolic Link (Symlink) Following (The product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. This could allow an attacker to cause the product to operate on unauthorized files.).
How can I check Packagist dependencies for CVE-2026-62992?
Run the dependency tree command: 'inspect dependencies for smarty/smarty'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-f6wf-28g6-769x",
  "modified" : "2026-08-07T15:02:40Z",
  "published" : "2026-08-07T15:02:39Z",
  "aliases" : [ "CVE-2026-62992" ],
  "summary" : "Smarty: Symlink path traversal out of trusted directories",
  "details" : "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).\n\n## Impact\nAn 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.\n\n## Patches\nFixed 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.\n\n## Workarounds\nEnsure 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.\n\n## References\n- Fix commit: 99c048c\n- CWE-22",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "smarty/smarty"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.8.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "smarty/smarty"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.5.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/smarty-php/smarty/security/advisories/GHSA-f6wf-28g6-769x"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/smarty-php/smarty/commit/99c048ce7a590c519b79fbd38ad0143a08183a1f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/smarty-php/smarty/commit/a1ccdb0518021a559b4066c37b76a42c86bbce90"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/smarty-php/smarty"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/smarty-php/smarty/releases/tag/v4.5.7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/smarty-php/smarty/releases/tag/v5.8.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-61" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-07T15:02:39Z",
    "nvd_published_at" : null
  }
}