/

CVE-2026-65693

Severity:

HIGH RISK

(7.2)

SSTI (CWE-94) in Microweber CMS Mail Templates

CVE-2026-65693

Deferred

Vulnerability type

Category:

Server-Side Template Injection (SSTI)

CWE:

CWE-94

Impact:

Remote Code Execution via Template Engine

Severity:

HIGH RISK

(7.2)

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

Microweber CMS up to version 2.0.20 contains a server-side template injection flaw in its Twig-based mail rendering pipeline. An authenticated administrator can inject malicious Twig expressions into email templates stored in the database, leading to arbitrary OS command execution.

The vulnerability becomes risky whenever unsandboxed Twig templates are rendered without a security policy, causing attacker-supplied expressions to execute on any application event that triggers mail dispatch.

Microweber CMS up to version 2.0.20 contains a server-side template injection flaw in its Twig-based mail rendering pipeline. An authenticated administrator can inject malicious Twig expressions into email templates stored in the database, leading to arbitrary OS command execution.

The vulnerability becomes risky whenever unsandboxed Twig templates are rendered without a security policy, causing attacker-supplied expressions to execute on any application event that triggers mail dispatch.

Affected context

This vulnerability arises in Microweber CMS deployments that:

  • Allow administrative users to edit email or mail templates
  • Persist template bodies directly to the database without validation or sanitization
  • Render templates using TwigView::render() in an unsandboxed Twig environment
  • Lack the SandboxExtension or a restrictive SecurityPolicy for Twig

In such configurations, dynamic template rendering becomes part of the execution path for application events that send emails.

This vulnerability arises in Microweber CMS deployments that:

  • Allow administrative users to edit email or mail templates
  • Persist template bodies directly to the database without validation or sanitization
  • Render templates using TwigView::render() in an unsandboxed Twig environment
  • Lack the SandboxExtension or a restrictive SecurityPolicy for Twig

In such configurations, dynamic template rendering becomes part of the execution path for application events that send emails.

Exploit preconditions

  • Attack surface: Mail template editing interfaces and any functionality that dispatches emails.
  • Required access: Authenticated administrator (or equivalent) access capable of modifying mail templates stored in the CMS.
  • Trigger point: Any subsequent application event that causes the vulnerable mail template to be rendered and sent (e.g., user registration, notifications).
  • Why exploitation is possible: The Twig environment used in TwigView::render() operates without sandboxing or a security policy, allowing powerful Twig features (filters, functions) to be invoked directly from template content, turning template data into executable logic.
  • Attack surface: Mail template editing interfaces and any functionality that dispatches emails.
  • Required access: Authenticated administrator (or equivalent) access capable of modifying mail templates stored in the CMS.
  • Trigger point: Any subsequent application event that causes the vulnerable mail template to be rendered and sent (e.g., user registration, notifications).
  • Why exploitation is possible: The Twig environment used in TwigView::render() operates without sandboxing or a security policy, allowing powerful Twig features (filters, functions) to be invoked directly from template content, turning template data into executable logic.

Why this happens

The core issue is the misuse of a general-purpose template engine (Twig) in a context where template content is treated as trusted code rather than untrusted data. Instead of applying sandboxing or security policies, the application renders templates using a fully-privileged Twig environment and persists template bodies from the CMS UI straight to the database.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where untrusted input is incorporated into an execution context. In the abstract, any system that lets users define or modify templates, scripts, or expressions that are later evaluated by a powerful engine without restrictions risks turning content fields into arbitrary code execution primitives.

The core issue is the misuse of a general-purpose template engine (Twig) in a context where template content is treated as trusted code rather than untrusted data. Instead of applying sandboxing or security policies, the application renders templates using a fully-privileged Twig environment and persists template bodies from the CMS UI straight to the database.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where untrusted input is incorporated into an execution context. In the abstract, any system that lets users define or modify templates, scripts, or expressions that are later evaluated by a powerful engine without restrictions risks turning content fields into arbitrary code execution primitives.

Potential impact

  • An attacker with admin access may execute arbitrary OS commands on the server.
  • CMS runtime and underlying web server processes could be fully compromised.
  • Application data, including user accounts and content, may be read, modified, or destroyed.
  • The compromised CMS instance could be used to pivot deeper into the hosting environment or internal network.
  • Email dispatch workflows can be hijacked to exfiltrate sensitive information or send malicious messages.
  • An attacker with admin access may execute arbitrary OS commands on the server.
  • CMS runtime and underlying web server processes could be fully compromised.
  • Application data, including user accounts and content, may be read, modified, or destroyed.
  • The compromised CMS instance could be used to pivot deeper into the hosting environment or internal network.
  • Email dispatch workflows can be hijacked to exfiltrate sensitive information or send malicious messages.

General mitigation guidance

Effective mitigation centers on treating template content as potentially untrusted and removing direct execution capabilities from user-defined templates. Common defensive patterns include:

  • Applying Twig sandboxing via SandboxExtension with a strict SecurityPolicy that whitelists only safe tags, filters, and functions.
  • Separating logic from content: restrict user-editable templates to presentation-only constructs and avoid exposing functions or filters that reach the filesystem, process execution, or environment.
  • Enforcing validation and normalization of template input, rejecting or stripping dangerous constructs (e.g., function calls, dynamic filters) from editable fields.
  • Designing mail templates as configurable but non-executable, with placeholders limited to simple variable substitution and no arbitrary expression evaluation.
  • Running the CMS with least privilege, ensuring the process account has minimal access to the filesystem and OS-level commands, to reduce blast radius if a template is misused.

Effective mitigation centers on treating template content as potentially untrusted and removing direct execution capabilities from user-defined templates. Common defensive patterns include:

  • Applying Twig sandboxing via SandboxExtension with a strict SecurityPolicy that whitelists only safe tags, filters, and functions.
  • Separating logic from content: restrict user-editable templates to presentation-only constructs and avoid exposing functions or filters that reach the filesystem, process execution, or environment.
  • Enforcing validation and normalization of template input, rejecting or stripping dangerous constructs (e.g., function calls, dynamic filters) from editable fields.
  • Designing mail templates as configurable but non-executable, with placeholders limited to simple variable substitution and no arbitrary expression evaluation.
  • Running the CMS with least privilege, ensuring the process account has minimal access to the filesystem and OS-level commands, to reduce blast radius if a template is misused.

How teams detect issues like this

Detection approaches typically focus on identifying risky template engine usage and monitoring execution flows where user-controlled content reaches evaluation APIs:

  • Static analysis rules that flag calls to Twig renderers used with templates sourced from editable CMS fields, especially when SandboxExtension or SecurityPolicy is absent.
  • Code review checklists that explicitly require verification of template engine configuration, paying attention to allowed functions, filters, and tags for user-defined templates.
  • Policy enforcement that prohibits dynamic evaluation of templates composed from database-backed content without sanitization or sandboxing, enforceable via linters or CI gates.
  • Instrumentation and logging around mail dispatch and template rendering paths, combined with anomaly detection to spot unusual or complex Twig expressions in templates.
  • Use of automated security testing tools that include SSTI test cases against template-editing interfaces to surface injection opportunities before deployment.

Detection approaches typically focus on identifying risky template engine usage and monitoring execution flows where user-controlled content reaches evaluation APIs:

  • Static analysis rules that flag calls to Twig renderers used with templates sourced from editable CMS fields, especially when SandboxExtension or SecurityPolicy is absent.
  • Code review checklists that explicitly require verification of template engine configuration, paying attention to allowed functions, filters, and tags for user-defined templates.
  • Policy enforcement that prohibits dynamic evaluation of templates composed from database-backed content without sanitization or sandboxing, enforceable via linters or CI gates.
  • Instrumentation and logging around mail dispatch and template rendering paths, combined with anomaly detection to spot unusual or complex Twig expressions in templates.
  • Use of automated security testing tools that include SSTI test cases against template-editing interfaces to surface injection opportunities before deployment.

Sources

SourceLink
gist.github.comgist.github.com/W40X/584f4b088d310bc5280cc74bbf97831a
vulncheck.comvulncheck.com/advisories/microweber-cms-server-side-template-injection-via-mail-templates

Frequently asked

questions

Yes, but exploitation generally requires authenticated access to the CMS interface with privileges to edit mail templates. Once a malicious template is saved, subsequent mail dispatch events can trigger remote code execution on the server.

The described scenario involves an attacker who has administrator-level access or equivalent rights to modify email templates. Compromise of such an account, or misuse by a malicious insider, is sufficient to exploit the vulnerability.

The most robust fix is to treat user-editable templates as data, not code: enable Twig sandboxing with a restrictive security policy, limit templates to simple variable interpolation, and ensure that no execution-capable functions, filters, or tags are available in content that users can modify.

Adopt a secure-by-default template design: use sandboxed template engines for any user-supplied content, separate logic from presentation, perform security-focused code reviews of all rendering paths, and enforce automated checks to block introduction of new unsandboxed evaluation points in CI/CD pipelines.

Yes, but exploitation generally requires authenticated access to the CMS interface with privileges to edit mail templates. Once a malicious template is saved, subsequent mail dispatch events can trigger remote code execution on the server.

The described scenario involves an attacker who has administrator-level access or equivalent rights to modify email templates. Compromise of such an account, or misuse by a malicious insider, is sufficient to exploit the vulnerability.

The most robust fix is to treat user-editable templates as data, not code: enable Twig sandboxing with a restrictive security policy, limit templates to simple variable interpolation, and ensure that no execution-capable functions, filters, or tags are available in content that users can modify.

Adopt a secure-by-default template design: use sandboxed template engines for any user-supplied content, separate logic from presentation, perform security-focused code reviews of all rendering paths, and enforce automated checks to block introduction of new unsandboxed evaluation points in CI/CD pipelines.

Find out what's already
exploitable in your codebase.