Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify upload dir inside Smarty secure_dir
-
DeliveryPlace symlink targeting sensitive file
-
ExploitTrigger template render referencing symlink
-
Execution_checkDir() approves symlink path
-
Persistfile_get_contents() follows symlink
-
ImpactArbitrary file contents returned to attacker
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK
2 techniques across 2 tactics: Discovery, Collection The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Smarty's Security policy must be explicitly instantiated and assigned to the Smarty object - this is not the default configuration. The attacker must be able to cause a symbolic link to exist inside a directory that Smarty lists as a trusted secure_dir or template directory (e.g., an upload area co-located with the template path). The attacker must additionally be able to cause a template to reference that symlink path via an {include} or {fetch} directive. Limiting factors: PR:H per the CVSS 4.0 vector - the attacker needs privileged write access to a trusted directory; the target file must be readable by the PHP process user; and the specific deployment must have a symlink-writable path that overlaps with Smarty's trust boundary, which is not a default or common setup. |
| Impact | The provided CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:N/VA:N) yields a score of 6.9, reflecting high-privilege requirements but no user interaction and full confidentiality impact. The PR:H rating is critical context: exploitation requires the attacker to already possess sufficient access to create or place a symlink inside a directory that Smarty treats as trusted - a non-trivial prerequisite that substantially limits real-world exposure. The AC:L/AT:N pairing in the official vector appears slightly optimistic; a realistic assessment would assign AT:P because the attack depends on a specific deployment condition (a writable upload area co-located with the template path) that is not a default configuration. No EPSS score was provided in the input, but given the high-privilege prerequisite and the absence of any KEV listing or known POC, mass exploitation is implausible. Risk is highest for multi-tenant PHP applications (e.g., CMSes, web hosting panels) where lower-privileged users can write files to directories that a higher-privileged Smarty installation treats as trusted. The confidentiality-only impact (C:H, I:N, A:N) bounds the blast radius to information disclosure - sensitive files readable by the PHP process such as credentials, config files, or application source code. |
| Exploit ScenarioDerived | An attacker with write access to a web application's user-upload area - which an administrator has inadvertently placed inside a Smarty secure_dir - uploads or causes the creation of a symbolic link named (for example) config.php pointing to /etc/passwd or the application's database credentials file. The attacker then triggers a template render (via a normal application request) that causes Smarty to {include} or {fetch} that symlink path; _checkDir() validates the symlink's path (which lies inside the trusted directory) and approves it, while the subsequent file read follows the symlink to the sensitive target file, returning its contents to the attacker. No public exploit code is known at time of analysis. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 07, 2026
Symlink-based path traversal in Smarty's Security::_checkDir() allows an attacker who can place a symbolic link inside a trusted directory (such as a template or upload path) to read arbitrary files accessible to the PHP process, bypassing the configured secure_dir sandbox entirely. Affected are Smarty 5.x versions prior to 5.8.2 and all 4.x releases prior to 4.5.7, when Smarty's Security policy is enabled. The root cause is that _checkDir() resolves paths via string normalization only, while the underlying file_get_contents() call faithfully follows symlinks to their targets outside the sandbox. No public exploit code or CISA KEV listing has been identified at time of analysis.
RemediationAI
The primary fix is to upgrade to Smarty 5.8.2 (5.x users) or Smarty 4.5.7 (4.x users); both releases are available via Composer (composer update smarty/smarty) and as tagged GitHub releases at https://github.com/smarty-php/smarty/releases/tag/v5.8.2 and https://github.com/smarty-php/smarty/releases/tag/v4.5.7. For deployments that cannot patch immediately, the recommended workaround per the GHSA advisory (https://github.com/smarty-php/smarty/security/advisories/GHSA-f6wf-28g6-769x) is to ensure that no untrusted process or user can create files or symlinks within any directory listed in secure_dir or the configured template directories - concretely, restrict filesystem write permissions on those directories to the application's own deployment user only and remove any user-upload paths from the set of Smarty-trusted directories. The trade-off of the workaround is operational complexity: it may require restructuring upload handling so that user-writable paths are fully separate from Smarty-trusted paths.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in composer, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Smarty (cpe:2.3:a:smarty-php:smarty:*:*:*:*:*:*:*:*) is a PHP template engine that exposes {include} and {fetch} directives for reading local files. When its Security policy is active, Security::_checkDir() gates every file-read by verifying the requested path falls within a configured set of secure_dir or template directories. The flaw (CWE-22, Path Traversal) is that _checkDir() canonicalized paths using Smarty::_realpath(), a custom method that only normalizes dot-segments and separators as a string operation - it never calls the native PHP realpath() and therefore never resolves symbolic links to their on-disk targets. Because the subsequent file read (file_get_contents()) does follow symlinks, a symlink placed inside a trusted directory passed the trust check while pointing outside the sandbox. The fix in commits 99c048c and a1ccdb0 replaces the string-only normalization with native realpath() for files that exist on disk, and also canonicalizes trusted-directory entries the same way, preserving legitimate deployment symlinks such as Capistrano current or macOS /var → /private/var.
Know when Smarty gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
High complexity (AC:H) because a specific deployment overlap between upload paths and trusted template directories is required; PR:H and C:H match the official assessment.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
1DescriptionCVE.org
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.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
Smarty before 3.1.21 allows remote attackers to bypass the secure mode restrictions and execute arbitrary PHP code as de
Smarty_Security::isTrustedResourceDir() in Smarty before 3.1.33 is prone to a path traversal vulnerability due to insuff
Smarty PHP template engine versions 5.0.0 through 5.8.3 expose a security policy bypass allowing file disclosure via the
Smarty before 3.1.33-dev-4 allows attackers to bypass the trusted_dir protection mechanism via a file:./../ substring in
Smarty before 3.1.39 allows code injection via an unexpected function name after a {function name= substring. Rated crit
PHP code injection in the Smarty templating engine allows remote code execution in applications running Smarty 4.x befor
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Rate
Cross-site scripting (XSS) vulnerability in the smarty_function_html_options_optoutput function in distribution/libs/plu
Smarty before 3.1.39 allows a Sandbox Escape because $smarty.template_object can be accessed in sandbox mode. Rated high
Server-side request forgery in Smarty's {fetch} template function (versions prior to 4.5.7 on the 4.x line and 5.8.2 on
Smarty is a template engine for PHP. Rated medium severity (CVSS 6.1), this vulnerability is remotely exploitable, no au
Auth. Rated medium severity (CVSS 4.8), this vulnerability is remotely exploitable, low attack complexity. No vendor pat
EUVD-2026-54498
GHSA-f6wf-28g6-769x
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB