Smarty Php
Monthly
PHP code injection in the Smarty templating engine allows remote code execution in applications running Smarty 4.x before 4.5.8 or 5.x before 5.8.5 that render templates through the extends:/multi-component inheritance path with caching enabled. When such a template is compiled, the top-level unifunc never restores its nocache_hash, so the value is null; combined with an empty regex alternative in the cache-split logic, attacker-controlled assigned data containing a forged /*%%SmartyNocache:%%*/ marker is copied verbatim (bypassing PHP-tag neutralization) into the regenerated PHP cache file and executed on the next include. Exploitation is unauthenticated per the vendor CVSS vector (PR:N) but is gated by strict preconditions - inheritance-path templates, active caching, unescaped attacker-controlled output, and a fresh PHP process that reloads the compiled file after the cache entry is evicted (TTL expiry or cache clear) while compiled files persist - making it conditional rather than reliably on-demand; no public exploit code or confirmed in-the-wild exploitation was identified at time of analysis.
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 the 5.x line) allows network-accessible attackers to bypass the trusted_uri allowlist and reach arbitrary internal endpoints by exploiting PHP's default redirect-following behavior. The security policy's isTrustedUri() check validates only the initial URL; when file_get_contents() silently follows an HTTP redirect placed on a trusted host, the request lands on an attacker-chosen internal target, enabling SSRF to services such as cloud metadata endpoints or internal APIs. No public exploit has been identified at time of analysis, and the vulnerability is not listed in the CISA KEV catalog.
Smarty PHP template engine versions 5.0.0 through 5.8.3 expose a security policy bypass allowing file disclosure via the built-in `stream:` resource type. When Smarty Security is enabled and `Security::$streams` is set to `null` or a restricted allowlist, an attacker able to author or influence a template resource reference can use `stream:php://filter/...` to read arbitrary local files accessible to the PHP process - bypassing the very control intended to block such access. A public proof-of-concept was disclosed in GHSA-rjhh-76wf-8xmw; no active exploitation is confirmed in CISA KEV. The issue is fixed in v5.8.4.
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.
PHP code injection in the Smarty templating engine allows remote code execution in applications running Smarty 4.x before 4.5.8 or 5.x before 5.8.5 that render templates through the extends:/multi-component inheritance path with caching enabled. When such a template is compiled, the top-level unifunc never restores its nocache_hash, so the value is null; combined with an empty regex alternative in the cache-split logic, attacker-controlled assigned data containing a forged /*%%SmartyNocache:%%*/ marker is copied verbatim (bypassing PHP-tag neutralization) into the regenerated PHP cache file and executed on the next include. Exploitation is unauthenticated per the vendor CVSS vector (PR:N) but is gated by strict preconditions - inheritance-path templates, active caching, unescaped attacker-controlled output, and a fresh PHP process that reloads the compiled file after the cache entry is evicted (TTL expiry or cache clear) while compiled files persist - making it conditional rather than reliably on-demand; no public exploit code or confirmed in-the-wild exploitation was identified at time of analysis.
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 the 5.x line) allows network-accessible attackers to bypass the trusted_uri allowlist and reach arbitrary internal endpoints by exploiting PHP's default redirect-following behavior. The security policy's isTrustedUri() check validates only the initial URL; when file_get_contents() silently follows an HTTP redirect placed on a trusted host, the request lands on an attacker-chosen internal target, enabling SSRF to services such as cloud metadata endpoints or internal APIs. No public exploit has been identified at time of analysis, and the vulnerability is not listed in the CISA KEV catalog.
Smarty PHP template engine versions 5.0.0 through 5.8.3 expose a security policy bypass allowing file disclosure via the built-in `stream:` resource type. When Smarty Security is enabled and `Security::$streams` is set to `null` or a restricted allowlist, an attacker able to author or influence a template resource reference can use `stream:php://filter/...` to read arbitrary local files accessible to the PHP process - bypassing the very control intended to block such access. A public proof-of-concept was disclosed in GHSA-rjhh-76wf-8xmw; no active exploitation is confirmed in CISA KEV. The issue is fixed in v5.8.4.
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.