Check out the latest research from IONIX: NEW! State of the WAF Report

New CVE Detected

CVE-2026-82531 – Remote Code Injection via Template Cache Poisoning – Smarty < 4.5.8 / 5.x < 5.8.5

Be the first to know when new zero-days emerge:

Summary

CVE-2026-82531 is a code injection vulnerability in the Smarty PHP template engine affecting versions before 4.5.8 and 5.x before 5.8.5. The flaw occurs because the top-level nocache_hash value is never restored when a template is rendered through the extends:/multi-component inheritance path, leaving it null and allowing attacker-controlled template output to forge a {nocache} marker. This lets an attacker inject raw PHP code into the generated template cache file, resulting in remote code execution on next render — rated 9.2 (Critical).

Technical details

  • Root cause: Smarty’s cache-compiler fails to restore the top-level nocache_hash during extends:/multi-component template inheritance, leaving it null instead of a unique per-compile value.
  • Trigger condition: An attacker who can influence template content or variables rendered through inheritance (extends: resource or multi-component templates) can forge a {nocache} marker because the hash used to validate legitimate nocache blocks is missing/predictable (null).
  • Attack vector: Network — exploitable in any application that compiles and caches Smarty templates where template content, variables, or includes can be influenced by untrusted input (e.g., user-supplied template fragments, CMS theming, multi-tenant templating).
  • Impact: Once the forged nocache marker is accepted, arbitrary raw PHP is written into the compiled/cached template file. On the next request that renders the cached template, the injected PHP executes in the context of the web application — leading to full remote code execution, and compromising confidentiality, integrity, and availability of the host.
  • Vulnerability class: CWE-94 (Improper Control of Generation of Code / Code Injection).
  • Reporter: Credited to security researcher MegaManSec.

Affected software

  • Smarty (smarty/smarty) versions 0 up to (but not including) 4.5.8
  • Smarty (smarty/smarty) versions 5.0.0 up to (but not including) 5.8.5

Severity

  • CVSS score (as rated by IONIX/reporting source): 9.2 (Critical)
  • CVSS v3.1 vector (per CVE record): CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H (Base score 8.1, High)
  • CWE: CWE-94 — Improper Control of Generation of Code (‘Code Injection’)

Mitigation and recommended actions

  • Immediate: Upgrade to Smarty 4.5.8 (4.x branch) or Smarty 5.8.5 (5.x branch), both of which restore the nocache_hash correctly during extends:/multi-component template inheritance and prevent forged nocache markers from being written to the cache.
  • If immediate patching is not possible:
    • Disable or avoid use of template caching (caching) in combination with extends:/multi-component template inheritance for any template whose content or variables can be influenced by untrusted or external input.
    • Restrict the ability of untrusted users to author, upload, or otherwise influence template content, includes, or variables rendered through inheritance.
    • Audit and, where necessary, purge existing compiled/cached template files to remove any previously injected code, then regenerate caches only after patching.
    • Apply the principle of least privilege to the web server process so that even if PHP code is injected into a cache file, its execution impact is constrained.

References

Get a free Attack Surface scan to see if you’re exposed.

Get a free Attack Surface scan to see if you’re exposed.

How IONIX’s External Exposure Management Platform Detects and Validates
Zero-Days to Shrink MTTR

1

Map your entire attack surface (continously)

IONIX uses multi-factor discovery methods, including DNS analysis, certificate mapping, metadata inspection, and more, to automatically map every internet-facing asset across your environment. This includes cloud instances, third-party platforms, shadow IT, and even forgotten infrastructure that traditional tools miss.

2

Monitor for new CVEs

Dozens of threat intel feeds using agentic technology are continuously analyzed to detect the appearance of proof-of-concept code, exploit kits, and indicators of active targeting. IONIX goes further by applying AI to proactively evaluate whether emerging vulnerabilities are likely to be exploited, even before PoCs go public.

3

Identify Potential External Exposures

Not all CVEs matter. IONIX filters vulnerabilities by asking attacker-centric questions: Can it be reached from the internet? Does it require authentication? Is it being exploited in the wild? This dramatically reduces noise and focuses teams on threats that can actually be weaponized.

4

Create Safe, Scalable Exploit Validations

IONIX transforms real-world PoCs into safe, non-intrusive test payloads that can be run in production environments without disruption. These simulations are precisely targeted to the systems that are vulnerable, ensuring rapid validation without unnecessary load.

5

Execute Exploit Validations

By combining context about software stack, versioning, exposure status, and reachability, IONIX ensures that only the right payloads are executed against the right assets, maximizing efficiency and minimizing risk.

6

Drive Fast and Actionable Remediation

Results are routed through integrations with ticketing, SOAR, and SIEM tools. Issues are written in plain language, bundled into remediation clusters, and prioritized based on asset criticality, exploitability, and blast radius. This shortens mean time to remediation (MTTR) and empowers teams to act with confidence.

Are you exposed?

Get a free report of your organization’s exposure to this CVE and threat

Subscribe to Threat Center RSS

Copy/paste the link below into your preferred RSS reader or follow these instructions to subscribe to Slack alerts.

Get Real-Time CVE Alerts to Your Email

Be the first to know when new zero-days emerge