# CVE-2023-37470: Metabase vulnerable to remote code execution via POST /api/setup/validate API endpoint

> Attackers can execute arbitrary code on Metabase servers by injecting malicious commands into H2 database connection strings via the setup validation API.

- **Severity:** Critical 10.0 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 4 Aug 2023
- **Updated:** 17 Oct 2024
- **Also known as:** GHSA-p7w3-9m58-rq83

## What is CVE-2023-37470?

CVE-2023-37470 is a critical code injection vulnerability in metabase, published on 4 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Metabase is an open-source business intelligence and analytics platform. Prior to versions 0.43.7.3, 0.44.7.3, 0.45.4.3, 0.46.6.4, 1.43.7.3, 1.44.7.3, 1.45.4.3, and 1.46.6.4, a vulnerability could potentially allow remote code execution on one's Metabase server. The core issue is that one of the supported data warehouses (an embedded in-memory database H2), exposes a number of ways for a connection string to include code that is then executed by the process running the embedded database. Because Metabase allows users to connect to databases, this means that a user supplied string can be used to inject executable code. Metabase allows users to validate their connection string before adding a database (including on setup), and this validation API was the primary vector used as it can be called without validation. Versions 0.43.7.3, 0.44.7.3, 0.45.4.3, 0.46.6.4, 1.43.7.3, 1.44.7.3, 1.45.4.3, and 1.46.6.4 fix this issue by removing the ability of users to add H2 databases entirely. As a workaround, it is possible to block these vulnerabilities at the network level by blocking the endpoints `POST /api/database`, `PUT /api/database/:id`, and `POST /api/setup/validateuntil`. Those who use H2 as a file-based database should migrate to SQLite.

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2023-37470?

It affects 1 product.


Products: Metabase Metabase.

## How do I fix CVE-2023-37470?

No fix has been published for CVE-2023-37470 yet. Limit exposure of the affected software until one is available.

## Is CVE-2023-37470 being exploited?

There is no known exploitation of CVE-2023-37470 in the wild and no public exploit code.

## Other vulnerabilities in metabase

- [CVE-2026-72898](https://insights.sbomify.com/CVE-2026-72898/): Metabase SQL Injection (critical 10.0, exploited in the wild)
- [CVE-2021-41277](https://insights.sbomify.com/CVE-2021-41277/): Metabase GeoJSON API Local File Inclusion (critical 10.0, exploited in the wild)
- [CVE-2026-50148](https://insights.sbomify.com/CVE-2026-50148/): Metabase: Remote Code Execution via Snowflake JDBC Driver Arbitrary File Write (critical 10.0)
- [CVE-2026-59827](https://insights.sbomify.com/CVE-2026-59827/): Metabase: Unsafe Deserialization of H2 Query Results (critical 9.9)
- [CVE-2023-38646](https://insights.sbomify.com/CVE-2023-38646/): Command injection in n/a (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-37470 and fix it if it is affected.

What it is: CVE-2023-37470 is a critical code injection vulnerability in metabase, published on 4 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-37470 in the wild and no public exploit code.

Affected product: metabase. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-37470/ (Markdown: https://insights.sbomify.com/CVE-2023-37470/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-37470
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-37470
- OSV: https://osv.dev/vulnerability/CVE-2023-37470

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-37470/
Summaries are generated and may contain mistakes; the official description above is the record.
