Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconSubmit input containing forged SmartyNocache marker
-
DeliveryBenign render compiles inheritance template and caches output
-
ExploitCache evicted via TTL expiry while compiled file persists
-
InstallFresh PHP process reloads compiled file with null nocache_hash
-
C2Empty regex alternative accepts forged marker, payload written verbatim to cache
-
ExecuteCache file include() executes attacker PHP as application
-
ImpactRemote code execution on server
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires all of: (1) templates rendered via the extends:/multi-component inheritance path (not single-file templates); (2) caching enabled (e.g. CACHING_LIFETIME_CURRENT); (3) attacker-controlled assigned data emitted unescaped into template output; and (4) a fresh PHP process that reloads the compiled file from disk after the cache entry is evicted (TTL expiry or cache clear) while compiled files remain - this is the state in which the top-level unifunc's nocache_hash is null. Limiting factors: if the application does not use template inheritance, does not enable caching, or escapes/validates the attacker-supplied value, exploitation does not occur; the dependency on a post-eviction fresh-process reload (reflected as AT:P in CVSS 4.0) means exploitation is conditional rather than reliably on-demand. No special user interaction or authentication is required by the flaw itself. |
| Impact | This is a genuine high-priority vulnerability, but one whose real-world exploitability is gated by several preconditions that the raw 9.2 CVSS score obscures. The CVSS 4.0 vector (AV:N/AC:L/AT:P/PR:N/UI:N) describes a network-reachable, unauthenticated flaw with HIGH impact across confidentiality, integrity and availability (VC:H/VI:H/VA:H) - consistent with CWE-94 code injection yielding PHP RCE. The critical nuance is AT:P (Attack Requirements: Present), which signals that exploitation is NOT unconditional: per the vendor advisory and the regression test, the target must render templates through the extends:/multi-component inheritance path, have caching enabled, pass attacker-controlled data into an unescaped output, and crucially a fresh PHP process must reload the compiled file from disk (after cache eviction/TTL expiry) so that nocache_hash is left null. There is NO CISA KEV listing and no EPSS score provided, and no public weaponized exploit is indicated in the input; the only exploitation artifact is the vendor's own defensive regression test shipped with the fix, which demonstrates the mechanism but is not a drop-in attack tool. Signals therefore align rather than conflict: high technical impact is real, but neither active exploitation nor mass-scanning pressure is evidenced yet, so this reads as a serious, patch-now issue for exposed PHP/Smarty deployments rather than a confirmed in-the-wild emergency. Verify your environment actually uses template inheritance with caching before deprioritizing or over-prioritizing. |
| Exploit ScenarioDerived | An attacker submits a value (e.g. a form field or profile name) that is assigned into a Smarty template and echoed unescaped; the value embeds a forged '/*%%SmartyNocache:%%*/ ... /*/%%SmartyNocache:%%*/' marker wrapping raw PHP. On a Smarty instance using extends:/inheritance with caching, after the cache entry expires and a fresh PHP process regenerates it, the null top-level nocache_hash produces an empty regex alternative that treats the forged marker as a real nocache section, copying the attacker's PHP verbatim into the cache file. That PHP then executes on the next include(), yielding remote code execution. No public exploit is identified in the input, though the vendor shipped a regression test demonstrating the mechanism. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 06, 2026
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.
RemediationAI
Vendor-released patch: upgrade to Smarty 4.5.8 or Smarty 5.8.5 (or later). The fixes are the upstream commits c0fdd4824aca4f67e814b50703cfee1dfde41414 and 1cba51cb813563eb61d963c83d28cd59f26b858d, and the tagged releases are available at https://github.com/smarty-php/smarty/releases/tag/v4.5.8 and https://github.com/smarty-php/smarty/releases/tag/v5.8.5, with the advisory at https://github.com/smarty-php/smarty/security/advisories/GHSA-3w63-v7pm-cq9x. If an immediate upgrade is not possible, compensating controls should target the specific preconditions: (1) disable Smarty caching (set caching to CACHING_OFF or clear the cache directory and disable cache writing) - this removes the cache-regeneration step entirely but costs performance on every request; (2) avoid the extends:/multi-component template inheritance path in favor of single-file templates until patched - effective but may require template restructuring; (3) ensure all values passed to templates from untrusted sources are escaped or validated before assignment, ideally by enabling Smarty's default HTML escaping and avoiding |unescape / nofilter modifiers on user-controlled data - this blocks the injection vector but must be applied consistently, since a single unescaped sink is sufficient; and (4) never serve cache or compile directories over the web and restrict filesystem write access to them, which limits how injected content can be reached. Because exploitation requires a fresh PHP process reloading a compiled file after cache eviction, aggressively clearing both compiled and cached artifacts on deploy reduces exposure, though it is not a substitute for patching. Note the flaw is unauthenticated per the provided CVSS vector (PR:N), so network exposure to any vulnerable template path should be treated as high priority even though exploitation is conditional.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Smarty is a widely deployed PHP template engine that compiles templates into PHP files under a compile directory and, when caching is enabled, writes rendered output into cache files. The root cause is CWE-94 (Improper Control of Generation of Code / Code Injection) in \Smarty\Template\Cached::removeNoCacheHash(). Normally, nocache sections are delimited by /*%%SmartyNocache:<hash>%%*/ ... /*/%%SmartyNocache:<hash>%%*/ markers, and the hash is gathered from the compiled template's nocache_hash to build a regex alternation used to split cached from non-cached content. A template compiled through the inheritance/component path ('extends:') produces a top-level unifunc that never restores its nocache_hash, leaving it null on a fresh process that reloads the compiled file from disk. Folding that null into the alternation yields an empty alternative such as '(realhash|)', which matches a forged marker with no hash. Because content matched as a genuine nocache section is reproduced verbatim into the cache file without PHP-tag neutralization, an attacker who controls an assigned value echoed unescaped into the template can inject raw PHP that is written into the regenerated cache and executed when the cache file is subsequently include()d. The upstream fix guards the null case (only folding in a non-empty nocache hash, filtering empty hashes) and, when no legitimate nocache hashes exist, treats the entire buffer as ordinary output so PHP tags are neutralized; a regression test (NocacheHashInjectionTest) verifies the forged marker is not executed.
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:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Network-reachable and unauthenticated (AV:N/PR:N), but the required inheritance+caching path, cache eviction and fresh-process reload make it AC:H; successful PHP RCE gives full C:H/I:H/A:H with no scope change.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
Smarty before 4.5.8 and 5.x before 5.8.5 contains a code injection vulnerability where the top-level nocache_hash is never restored during extends:/multi-component template inheritance, leaving it null. Attackers can supply assigned data containing a forged SmartyNocache marker that is copied verbatim into the regenerated PHP cache file, executing arbitrary PHP on include for remote code execution.
Articles & Coverage 2
Technical POC Analysis
CWE-94 code injection in Smarty's cache generation.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
A critical remote code execution vulnerability in the Smarty templating engine (4.x before 4.5.8 and 5.x before 5.8.5) could let an unauthenticated attacker run arbitrary code on applications that render inherited templates with caching enabled. Because Smarty ships inside a broad range of PHP-based web applications and customer-facing platforms, a successful exploit could mean full server compromise, exposure of customer and business data, and service disruption. Exploitation depends on a specific combination of template design, caching configuration and unescaped user input, so risk is concentrated in internet-facing applications that meet those preconditions and should be prioritized for remediation.
Apply vendor patch.
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
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
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
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
Symlink-based path traversal in Smarty's Security::_checkDir() allows an attacker who can place a symbolic link inside a
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-93376
NVD
CVE.org
EPSS
Vulnrichment
GitHub
Exploit-DB