CVE-2026-82531

Smarty before 4.5.8 and 5.x before 5.8.5 PHP Code Injection via extends: Inheritance Cache

Published Oct 6, 2026 CVSS 4.0 · 9.2 Critical EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical 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.

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 available
History
Type Values Removed Values Added
First Time appeared Smarty-php
Smarty-php smarty
Vendors & Products Smarty-php
Smarty-php smarty
Type Values Removed Values Added
Metrics ssvc

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

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'}

Weaknesses
  • CWE-94

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

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Oct 6, 2026, 12:47 PM
Reserved
Aug 29, 2026, 5:20 PM
Status
Awaiting Analysis
Published
Oct 6, 2026, 1:16 PM
Modified
Oct 6, 2026, 4:00 PM