/

CVE-2026-59826

Severity:

CRITICAL RISK

(9.1)

Code Injection (CWE-94) via H2 DB config in Metabase

CVE-2026-59826

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution by authenticated administrators

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

Metabase contains a code injection flaw in one H2 database creation path where unsafe connection properties are not validated. This allows an authenticated administrator to register a crafted H2 connection and trigger arbitrary Java code execution on the Metabase server.

The vulnerability becomes critical wherever admin-level users can define H2 connections and the Metabase application runs with high privileges or broad network access.

Affected context

The issue occurs in Metabase deployments that use the affected versions and allow creation of H2 database connections through the administrative interface.

It is specifically tied to a database-creation code path that passes user-supplied H2 connection properties to the underlying driver without sufficient validation.

The risk is highest in environments where Metabase is exposed to multiple administrators or integrated into a broader analytics platform with elevated server privileges.

Exploit preconditions

  • Attack surface: Metabase server-side database configuration functionality
  • Required access: Authenticated Metabase administrator account able to add or modify database connections
  • Trigger point: Creation of a new H2 database connection using crafted connection properties in the vulnerable code path
  • Why exploitation is possible: The application fails to validate or restrict dangerous H2 connection parameters, allowing the database driver to interpret attacker-controlled values that can lead to arbitrary Java code execution

Why this happens

The root cause lies in treating database connection properties as inherently safe configuration rather than untrusted input.

In the vulnerable Metabase code path, user-controlled H2 connection settings are forwarded to the driver without filtering for known-dangerous options or enforcing a strict allowlist. Certain H2 features permit embedding executable expressions or loading classes, which the driver processes at connection time.

This behavior maps to CWE-94: Improper Control of Generation of Code, where attacker-controlled data influences code that is executed, in this case via the database engine's configuration mechanisms.

Potential impact

  • An authenticated administrator may execute arbitrary Java code on the Metabase server
  • Attackers could gain full control over the Metabase application process and its data
  • Compromise of credentials or API keys stored or managed by Metabase
  • Lateral movement into other systems reachable from the Metabase host
  • Disruption of analytics services through data tampering or service denial

General mitigation guidance

Effective mitigation focuses on constraining how configuration values reach executable components and reducing the trust assigned to administrative inputs:

  • Apply strict allowlisting to database connection properties, only permitting parameters required for safe operation
  • Normalize the treatment of administrative configuration as untrusted input, subject to validation and sanitization
  • Disable or restrict database engine features that permit code execution, class loading, or script evaluation where possible
  • Run Metabase with least-privilege OS and network permissions so that, even if code runs, its blast radius is reduced
  • Separate high-risk configuration capabilities (such as custom driver properties) from general administrative tasks, or gate them behind additional approvals

How teams detect issues like this

Organizations can detect similar issues and misuse patterns by:

  • Using static analysis to flag direct propagation of configuration parameters into database or driver APIs without validation
  • Reviewing database integration code for unbounded property passing, especially with engines known to support scripting or class loading
  • Implementing policy checks in code review and CI that require allowlists for connection properties and disallow known-dangerous options
  • Monitoring Metabase logs and runtime telemetry for unusual or rarely used H2 connection parameters associated with new database registrations
  • Employing application security testing tools that exercise administrative configuration flows, not just end-user queries

Sources

SourceLink
github.comgithub.com/metabase/metabase/commit/74032e5e0a5a70dc45a6a744d37b9ba24eee8d01
github.comgithub.com/metabase/metabase/releases/tag/v0.58.15.1
github.comgithub.com/metabase/metabase/releases/tag/v0.59.12
github.comgithub.com/metabase/metabase/releases/tag/v0.60.6.3
github.comgithub.com/metabase/metabase/releases/tag/v0.61.2
github.comgithub.com/metabase/metabase/security/advisories/GHSA-8wx2-rxp2-4x35

Frequently asked

questions

Exploitation generally requires an authenticated Metabase administrator account with permission to create or configure H2 database connections. Regular report viewers or non-admin users are typically not able to trigger the flaw directly.

No direct OS-level access is needed. The attacker interacts through the Metabase administrative interface, and crafted H2 connection properties are interpreted by the database driver, leading to code execution within the Metabase server process.

The most robust fix is to strictly validate and constrain configuration parameters before they reach any component capable of executing code, using allowlists for safe properties and disabling dangerous database features that interpret configuration as executable logic.

Treat all configuration supplied through user interfaces—even from administrators—as untrusted. Enforce strong input validation, review database engine capabilities for embedded execution features, and include administrative workflows in security testing and code review processes.

Find out what's already
exploitable in your codebase.