/

CVE-2026-27464

Severity:

HIGH RISK

(7.7)

Template Injection / Code Injection in Metabase Email

CVE-2026-27464

Analyzed

Vulnerability type

Category:

Template Injection / Code Injection

CWE:

CWE-94, CWE-1336

Impact:

Sensitive Information Disclosure and Potential Lateral Movement

Severity:

HIGH RISK

(7.7)

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

Metabase contains a vulnerability in its notification template evaluation that allows authenticated users to access sensitive information, including database access credentials, via email content.

When a low-privileged user can influence template data that is evaluated on the server, they may exfiltrate secrets from the Metabase instance into outbound emails.

Affected context

This vulnerability affects Metabase instances that:

  • Run versions prior to 0.57.13 or 0.58.x through 0.58.6
  • Have email notifications enabled (for alerts, pulses, or similar features)
  • Allow authenticated users, including low-privileged ones, to configure or influence content that is processed by the notification templating system

The issue appears when user-controllable input is evaluated within server-side templates, allowing access to internal configuration or secret values at render time.

Exploit preconditions

  • Attack surface: Metabase web interface and its notification/templating endpoints.
  • Required access: Valid authenticated user account; confirmed feasible with low-privileged roles able to create or modify notification content.
  • Trigger point: Creation or modification of notification templates or related content that is processed by the server-side template engine and then sent via email.
  • Why exploitation is possible: The template evaluation mechanism treats certain user-controllable fields as executable expressions or dynamic references, allowing them to reach internal configuration objects and sensitive values such as database credentials, which are then rendered into the email body.

Why this happens

The core issue is improper handling of user-controllable data within a server-side templating system, aligning with CWE-94: Improper Control of Generation of Code ('Code Injection') and CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine.

Instead of treating template inputs as data-only content, the system allows evaluation of template expressions that can reference sensitive runtime objects or configuration.

Because these expressions are executed in a privileged server context, a low-privileged user can indirectly invoke functionality or read configuration that would normally be inaccessible, leading to leakage of secrets such as database credentials through the rendered email output.

Potential impact

  • Exposure of database access credentials and other sensitive configuration values.
  • Unauthorized access to backend databases using stolen credentials.
  • Further compromise or lateral movement within the environment leveraging the exposed secrets.
  • Potential exposure of additional system internals, such as environment variables or connection strings, depending on what the template context can access.
  • Compliance and data privacy violations due to unintentional disclosure of secrets via email.

General mitigation guidance

Mitigation focuses on decoupling untrusted user input from powerful template evaluation contexts and minimizing the data exposed to templates:

  • Restrict templates to a strictly data-only syntax where user-controlled content cannot introduce executable expressions or access arbitrary objects.
  • Define an explicit, minimal set of safe variables and helpers that can be used in templates, and block access to configuration objects, secrets, and internal APIs.
  • Sanitize and neutralize special templating syntax in fields that may contain user-provided content, treating them as literal text rather than executable template code.
  • Apply the principle of least privilege to runtime configuration, avoiding unnecessary exposure of secrets in process memory or template contexts.
  • Limit who can create or edit notification templates, aligning permissions with operational need rather than convenience.
  • Consider segregating secret management (e.g., using dedicated secret stores) and ensuring templates never receive direct access to raw credentials.

How teams detect issues like this

Effective detection typically involves a combination of code-level and behavioral analysis:

  • Static analysis: Search for use of template engines where user-controllable input is passed directly into evaluation functions (e.g., render/eval-like APIs) without prior sanitization or context restriction.
  • Code review signals: Pay close attention to features that generate emails, alerts, or notifications and inspect how dynamic content is assembled; verify that templates cannot access configuration or secret-bearing objects.
  • Configuration and policy checks: Enforce internal guidelines that disallow server-side evaluation of user-controlled template expressions, especially in security-sensitive contexts like notifications and logging.
  • Runtime monitoring: Log and review unusual template expressions or email content patterns that appear to contain internal configuration or credentials; alert on emails that match patterns resembling connection strings or password formats.
  • Automated security testing tools and template-specific linters can be integrated into CI/CD pipelines to flag risky template usage patterns before deployment.

Sources

SourceLink
github.comgithub.com/metabase/metabase/releases/tag/v0.57.13
github.comgithub.com/metabase/metabase/releases/tag/v0.58.7
github.comgithub.com/metabase/metabase/security/advisories/GHSA-vcj8-rcm8-gfj9

Frequently asked

questions

Yes, if the Metabase instance is exposed to the internet and remote users can authenticate, they may exploit the vulnerability through the web interface, provided they can access the notification or template-related functionality.

No. The issue was confirmed to be exploitable by low-privileged authenticated users who can create or modify content that is processed by the notification templating engine.

The safest pattern is to prevent user-controlled data from being evaluated as executable template expressions. Use a restricted template environment with a tightly controlled set of variables, block access to configuration and secrets, and treat untrusted content as plain text.

When introducing templating or dynamic content features, design with data-only templating in mind: separate logic from presentation, strictly define the template context, sanitize or escape special syntax in user input, and conduct focused security reviews on any feature that evaluates templates or scripts on the server side.

Find out what's already
exploitable in your codebase.