Description
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.
Published: 2026-10-06
Score: 9.2 Critical
EPSS: < 1% Very Low
KEV: No
Impact: Remote Code Execution
Action: Immediate Patch
AI Analysis

Impact

This vulnerability allows an attacker to inject code through the extends/inheritance cache mechanism of the Smarty templating engine. The top‑level nocache_hash is never restored during extends or multi‑component template inheritance, leaving it null and enabling the insertion of a forged SmartyNocache marker. When the template is regenerated, the marker is written directly into the PHP cache file, which is then included and executed, leading to arbitrary PHP execution.

Affected Systems

The affected versions are all releases of Smarty before 4.5.8 and all versions of the 5.x line before 5.8.5. These include the commonly used Smarty 4.5.x and 5.x branches available from smarty‑php:smarty. Any installation relying on these versions is vulnerable unless upgraded.

Risk and Exploitability

The vulnerability carries a high CVSS score of 9.2, indicating a severe risk of remote code execution when exploited. The EPSS score is not available, and the vulnerability is not listed in CISA’s KEV catalog, so the prevalence of exploitation in the wild is unknown. Attackers would need to supply crafted template data containing the forged marker, which is then copied into a regenerated PHP cache file and executed. The risk is high for systems that enable template inheritance or caching without proper input validation.

Generated by OpenCVE AI on October 6, 2026 at 13:42 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Update Smarty to version 4.5.8 or newer, or 5.8.5 or newer, to apply the vendor’s patch that restores the nocache_hash during extends processing.
  • After upgrading, regenerate any existing cached template files to ensure no legacy cache files containing injected code remain.
  • Use input validation or sanitize data passed to Smarty templates to prevent forged markers from reaching the cache regeneration process.

Generated by OpenCVE AI on October 6, 2026 at 13:42 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 07 Oct 2026 09:15:00 +0000

Type Values Removed Values Added
First Time appeared Smarty-php
Smarty-php smarty
Vendors & Products Smarty-php
Smarty-php smarty

Tue, 06 Oct 2026 13:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Tue, 06 Oct 2026 12:45:00 +0000

Type Values Removed Values Added
Description 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.
Title Smarty before 4.5.8 and 5.x before 5.8.5 PHP Code Injection via extends: Inheritance Cache
First Time appeared Newmediacompany
Newmediacompany smarty
Weaknesses CWE-94
CPEs cpe:2.3:a:newmediacompany:smarty:*:*:*:*:*:*:*:*
Vendors & Products Newmediacompany
Newmediacompany smarty
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.2, 'vector': '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'}


Subscriptions

Newmediacompany Smarty
Smarty-php Smarty
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-10-06T12:47:10.950Z

Reserved: 2026-08-29T17:20:57.082Z

Link: CVE-2026-82531

cve-icon Vulnrichment

Updated: 2026-10-06T12:44:53.834Z

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-10-06T13:16:50.180

Modified: 2026-10-06T16:00:36.547

Link: CVE-2026-82531

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-07T09:00:15Z

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')