githubEdit

Metabase

Metabase is an open-source business intelligence tool that connects to databases and provides analytics dashboards.


Discovery

# Default port
# 3000 - HTTP

# Nmap fingerprint
nmap -sC -sV TARGET -p 3000
# Sign in to Metabase

# Version check - look in page source or API
curl http://TARGET:3000/api/session/properties | jq '.version'

CVE-2023-38646 - Pre-Auth RCE via Setup Token

Unauthenticated remote code execution through exposed setup-token endpoint.

Affected Versions:

  • Open-source: < 0.46.6.1

  • Enterprise: < 1.46.6.1

Reference: https://blog.assetnote.io/2023/07/22/pre-auth-rce-metabase/

Get Setup Token

The setup token is exposed via the properties API endpoint:

Exploitation

POC: https://github.com/m3m0o/metabase-pre-auth-rce-poc

Note: Command injection is blind - no output returned.

Reverse Shell

Direct reverse shells may not work. Use staged payload:


Post-Exploitation

Metabase Database

Metabase stores data in H2 database format (not SQLite):

Extracting Credentials from H2 Database

H2 database can't be opened with sqlite3. Use strings to extract data:

Cracking Metabase Password Hashes

Metabase uses bcrypt ($2a$):


Docker Environment Variables

When Metabase runs in Docker, credentials may be leaked via environment variables:

Container Escape

If running in Docker container, credentials found in ENV vars may work for SSH to host:


Useful API Endpoints

Endpoint
Description

/api/session/properties

Leaks setup-token, version info

/api/user

List users (requires auth)

/api/database

List database connections (requires auth)

/api/card

List saved questions/queries (requires auth)


Default Credentials

Metabase doesn't have default credentials - initial setup creates admin account.


References

  • https://github.com/m3m0o/metabase-pre-auth-rce-poc

  • https://blog.assetnote.io/2023/07/22/pre-auth-rce-metabase/

  • https://nvd.nist.gov/vuln/detail/CVE-2023-38646

Last updated