Authenticated Remote Code Execution in Metabase via H2 Deserialization
Metabase instances configured with H2 databases are vulnerable to authenticated remote code execution via insecure Java deserialization triggered through native SQL queries, identified as CVE-2026-59827.
CVE search metadata
CVE search record: CVE-2026-59827. Severity: critical. CVSS: 9.9. EPSS: 0.93%. KEV: no. Product: Metabase (0.58.0 - 0.58.14, 0.59.0 - 0.59.11, 0.60.0 - 0.60.6.2, 0.61.0 - 0.61.1.3). Brief: Authenticated Remote Code Execution in Metabase via H2 Deserialization. Brief link: https://feed.craftedsignal.io/briefs/2026-09-metabase-rce/
Metabase versions 0.58.0 through 0.61.1.4 are affected by a high-severity vulnerability (CVE-2026-59827) that allows authenticated attackers to achieve remote code execution (RCE). The vulnerability stems from insecure deserialization of Java objects within the H2 database engine, which Metabase uses for its internal data storage, including the default sample database.
When an attacker with sufficient privileges to execute native SQL queries interacts with an H2 database instance, they can leverage the 'OTHER' data type to pass arbitrary serialized Java objects to the application. Because the application fails to validate these objects, they are deserialized upon retrieval, leading to arbitrary code execution with the permissions of the Metabase process. This vulnerability is particularly dangerous for instances where the sample H2 database remains active and accessible to authenticated users. Defenders should prioritize patching to the versions listed in the vendor advisory.
Attack Chain
- The attacker authenticates to the target Metabase instance with valid user credentials.
- The attacker navigates to the query interface and identifies an accessible H2 database connection.
- The attacker crafts a malicious serialized Java object payload using external tooling.
- The attacker executes a native SQL query via the Metabase '/api/dataset' endpoint containing the payload cast to the H2 'OTHER' data type.
- The Metabase application processes the query and retrieves the data from the H2 database.
- The application performs insecure deserialization of the object returned in the query result column.
- The Java deserialization process triggers the execution of arbitrary system commands on the underlying server host.
Impact
Successful exploitation allows an authenticated attacker to execute arbitrary OS commands on the host running the Metabase application. This can lead to complete server compromise, including data exfiltration, lateral movement within the environment, and persistence establishment. The vulnerability affects a broad range of recent Metabase versions across various deployment environments.
Recommendation
Prioritize patching all Metabase installations to versions that address CVE-2026-59827 as documented in the GitHub security advisory GHSA-w95f-x9v9-wv36. If immediate patching is not possible, disable the sample H2 database and restrict 'native query' permissions for all non-administrative users.
Detection Engineering
Deploy monitoring for the following patterns in web server access logs to identify exploitation attempts:
- Enable web server logging for the '/api/dataset' endpoint to capture POST requests containing SQL queries.
- Monitor for native SQL queries involving the CAST function directed at H2-type databases that include suspicious hex strings or references to deserialization gadgets.
- Audit for unauthorized access to the '/api/dataset' endpoint by users without explicit database query permissions.
Immediate actions
Patch Metabase to 1.58.15 or later
Threat Hunt
Search logs for POST /api/dataset requests containing 'CAST(X' and 'AS OTHER' tokens
Data: Web server logs
Mitigations
Disable the sample H2 database and restrict native query access
CVE-2026-59827
Detection coverage 1
Detect CVE-2026-59827 Exploitation Attempt
highDetects exploitation attempts against Metabase by monitoring native SQL queries containing the CAST function and potential hex-encoded serialized Java objects directed at H2 databases.
Detection queries are available on the platform. Get full rules →