/

CVE-2026-45714

Severity:

CRITICAL RISK

(9.1)

Server-Side Template Injection in CubeCart Smarty Templates

CVE-2026-45714

Deferred

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-94, CWE-1336

Impact:

Remote Code Execution by Authenticated Admin Users

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

CubeCart's use of the Smarty template engine without security policies allows authenticated administrators to inject and execute arbitrary template code in multiple modules, including Email Templates, Invoices, Documents, and Contact Forms.

When an attacker with admin access can control template content, this unsafe evaluation can lead to remote code execution on the underlying server.

Affected context

The issue arises in CubeCart deployments where:

  • The Smarty template engine is used to render dynamic content for administrative features (e.g., Email Templates, Invoices, Documents, Contact Forms)
  • Template content can be edited or influenced by authenticated users with administrative privileges
  • Smarty Security Policies are not enabled or configured to restrict dangerous functions and PHP execution

In such contexts, template fields that are intended for layout or content customization effectively become a code execution surface when treated as executable template code.

Exploit preconditions

  • Attack surface: Administrative web interface for managing templates and related content (Email Templates, Invoices, Documents, Contact Forms).
  • Required access: Valid authenticated account with administrative privileges or any role that can create or modify templates rendered by Smarty.
  • Trigger point: Rendering of a crafted template or template-backed content by the Smarty engine, typically when sending emails, generating invoices/documents, or processing contact forms.
  • Why exploitation is possible: User-controlled template content is processed by Smarty with powerful features (e.g., function calls, PHP integration) and without security policies to restrict execution, enabling arbitrary code or command execution on the server.

Why this happens

This vulnerability stems from treating user-editable template content as trusted code in the Smarty engine without applying security controls.

Under CWE-94: Improper Control of Generation of Code ('Code Injection'), the system dynamically evaluates data that should be treated as content, not executable logic. Smarty's rich template syntax and optional PHP/function execution capabilities provide a code execution environment.

Because Smarty Security Policies are disabled or not enforced, templates supplied or modified by privileged users can access sensitive functions, invoke system commands, or interact directly with PHP, leading to server-side template injection and remote code execution.

CWE-1336 (Improper Neutralization of Special Elements in Template Engines) is reflected in the failure to restrict or sanitize template constructs that change control flow or call dangerous functions within the template language.

Potential impact

  • Remote execution of arbitrary operating system commands under the web server or PHP process account
  • Full compromise of the CubeCart application, including modification of business logic and templates
  • Access to or exfiltration of sensitive customer and order data stored by the ecommerce platform
  • Installation of webshells or backdoors for persistent access
  • Lateral movement to other systems reachable from the compromised host
  • Abuse of email templates for large-scale spam or phishing campaigns using the legitimate infrastructure

General mitigation guidance

Mitigation focuses on restricting what templates can do and treating template data as untrusted input:

  • Enable and configure Smarty Security Policies to disable dangerous features such as arbitrary PHP code execution, access to the filesystem, or system-level functions.
  • Constrain allowed template constructs to a minimal, declarative subset needed for presentation (e.g., variable interpolation and basic control structures) and disallow direct function or method calls where possible.
  • Segregate template editing capabilities from general administrative tasks; limit template modification to a small, trusted set of accounts following strong change-control processes.
  • Introduce a review/approval workflow for template changes so that potentially dangerous constructs are inspected before they reach production.
  • Apply the principle of least privilege to the web server and PHP runtime so that, even if template execution is abused, the process has minimal access to the underlying system and data.
  • Consider separating "content" fields (plain text/HTML) from "template logic" fields, treating most user-managed text as non-executable markup and rendering it without passing through the template engine.

How teams detect issues like this

Detection generally combines code-level review and runtime monitoring:

  • Static analysis / code review:
  • Search for template rendering calls that use Smarty (e.g., $smarty->fetch, $smarty->display) where the template source originates from a database or user-editable fields.
  • Flag any use of Smarty with security policies disabled or with permissive configurations that allow PHP code execution, unrestricted modifiers, or filesystem access.
  • Review administrative modules that allow editing of email, invoice, document, or contact form templates and verify that they cannot inject raw Smarty logic or functions.
  • Configuration and policy enforcement:
  • Enforce organizational policies that require template engines to run with sandboxing or security policies enabled by default.
  • Integrate configuration checks into CI pipelines to ensure Smarty is initialized with secure options.
  • Runtime and log monitoring:
  • Monitor application and web server logs for unexpected template errors, unusual function invocations from within templates, or command execution patterns originating from HTTP requests.
  • Use host-based intrusion detection (HIDS) or EDR solutions to alert on suspicious child processes or command lines spawned from the web server or PHP interpreter, which may indicate successful SSTI exploitation.
  • Automated security testing tools with SSTI test cases can be used to probe template-entry points in staging environments and detect dangerous template behavior before deployment.

Sources

SourceLink
github.comgithub.com/cubecart/v6/security/advisories/GHSA-pcfr-xgc9-xfv6

Frequently asked

questions

Yes, if the CubeCart administrative interface is exposed and an attacker can obtain valid admin credentials, they can exploit template-editing features remotely. However, exploitation still requires authenticated access with sufficient privileges.

Exploitation generally requires an authenticated user with administrative or template-management privileges. An attacker without such access would first need to compromise an admin account or escalate privileges through another vulnerability.

The most robust fix pattern is to treat templates as untrusted code and enforce strict sandboxing: enable template engine security policies, disable execution of PHP or system commands from templates, and restrict templates to a minimal, presentation-only feature set. Where possible, move business logic and any potentially dangerous behavior out of templates and into the application code.

Adopt a secure-by-default stance for template engines: always initialize them with security/sandboxing features turned on, prohibit runtime configuration that relaxes these controls, and limit who can edit templates. Complement this with coding guidelines, security training for developers around SSTI risks, automated checks for unsafe template configurations, and routine security reviews of administrative features that expose powerful templating capabilities.

Find out what's already
exploitable in your codebase.