Summary
Metabase Enterprise contains an unsafe serialization import pathway that lets authenticated admins craft archives which manipulate the H2 JDBC configuration and inject an INIT property.
When such a malicious archive is imported, arbitrary SQL can run during database synchronization, enabling remote code execution and arbitrary file reads on the Metabase server under certain configurations.
Affected context
This vulnerability affects Metabase Enterprise deployments that expose the /api/ee/serialization/import endpoint and allow admin users to import configuration or serialization archives.
The issue occurs specifically when deserialized data is trusted to populate H2 JDBC connection properties, including the INIT parameter, which H2 interprets and executes during database initialization or synchronization.
Metabase OSS instances are not impacted because they do not include the enterprise serialization code paths.
Exploit preconditions
- Attack surface: HTTP API endpoint
POST /api/ee/serialization/importon Metabase Enterprise. - Required access: Authenticated Metabase admin-level account (local or cloud-hosted).
- Trigger point: Importing a crafted serialization archive that injects a malicious
INITproperty into the H2 JDBC specification. - Why exploitation is possible: The serialization import mechanism treats attacker-controlled serialized content as trusted configuration and passes it through to H2 without sufficiently constraining or sanitizing the
INITparameter, allowing H2 to execute arbitrary SQL that can be leveraged for RCE and file reads depending on server configuration.
Why this happens
The root cause is an unsafe deserialization and configuration binding pattern in the enterprise serialization import feature.
User-provided serialization archives are deserialized and used to reconstruct Metabase configuration, including JDBC connection details for H2.
This behavior aligns with CWE-502: Deserialization of Untrusted Data, where serialized input from a potentially adversarial source is accepted, parsed, and directly used to influence runtime behavior.
By allowing a serialized object to define the H2 INIT property, the application effectively embeds executable SQL instructions into connection setup logic, crossing the boundary between data and code and enabling high-impact side effects such as remote code execution and arbitrary file access.
Potential impact
- Remote code execution on the Metabase application server, subject to the runtime's OS-level privileges and environment.
- Arbitrary file read on the server filesystem, which could expose configuration files, credentials, or other sensitive data.
- Unauthorized access to or modification of data in connected databases via injected SQL.
- Lateral movement or further compromise within the hosting environment if RCE is chained with other weaknesses.
- Disclosure of secrets that may enable compromise of related services or infrastructure.
General mitigation guidance
Mitigation should focus on eliminating unsafe deserialization and restricting how imported content can influence database configuration:
- Treat all serialized input as untrusted and avoid directly binding deserialized structures to JDBC connection properties or other sensitive runtime configuration.
- Introduce strict schema validation for imported archives, permitting only a minimal, well-defined set of fields and explicitly disallowing parameters like H2
INITor any other execution-capable properties. - Apply a "configuration allowlist" approach where connection options must be chosen from predefined safe sets rather than arbitrary user-specified values.
- Separate configuration concerns so that complex or dangerous DB-level features (e.g., initialization commands) cannot be toggled via importable data.
- Run the Metabase application with least-privilege OS accounts and minimal filesystem access to limit the blast radius of any file read or RCE condition.
- Where feasible, isolate Metabase in hardened containers or sandboxes so that database initialization or sync logic cannot be used to escalate privileges beyond the service scope.
How teams detect issues like this
Detection efforts can combine code-centric and operational approaches:
- Static analysis: Flag deserialization or object mapping code that:
- Accepts uploaded/archive data and binds it directly into configuration or connection objects.
- Allows user-controlled values to populate JDBC URLs or properties like
INIT,AUTO_SERVER, or similar special parameters. - Code review signals:
- Serialization/import features that reconstruct complex application state, especially database connections, from user-supplied archives.
- Absence of explicit allowlists or schema validation for imported configuration fields.
- Direct hand-off of deserialized config to third-party libraries (like H2) without intermediate validation or normalization.
- Runtime monitoring:
- Log and alert on unusual or newly observed values in JDBC URLs or connection properties, particularly those that invoke H2 initialization commands.
- Track access to the
POST /api/ee/serialization/importendpoint and flag atypical usage patterns, large or frequent imports, and imports originating from unfamiliar admin accounts or IP ranges. - Monitor server behavior for unexpected shell commands, file access anomalies, or SQL statements that appear unrelated to normal analytics workflows.
- Security tooling:
- Apply SAST and dependency-aware scanners configured to recognize unsafe deserialization patterns and high-risk configuration flows.
- Use WAF or API gateways with rules that can constrain or inspect serialization import requests for suspicious payload characteristics where feasible.

