Exploit database

GH-2d54616bc8503eb23871ef3070087542

devianntsec/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 files1
devianntsec/cve-2025-55182Revision e1ff2936300e

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

vulnerable-app/scripts/restore.sh

Shell · 5,678 bytes
#!/bin/bash
# restore.sh - Restoration script for CVE-2025-55182 vulnerable laboratory
# Author: Annais Molina (devianntsec)
# GitHub: @devianntsec
# 
# This script is part of my Master's Thesis Research on CVE-2025-55182
# It restores the vulnerable application to its original state after attacks
# while preserving custom scripts (exploit, restore.sh itself, etc.)
# Usage: ./restore.sh

echo "╔══════════════════════════════════════════════════════════════╗"
echo "║     RESTORING VULNERABLE LABORATORY TO ORIGINAL STATE        ║"
echo "║                    by Annais Molina (devianntsec)            ║"
echo "╚══════════════════════════════════════════════════════════════╝"

# 1. Verify we are in the correct directory
echo "[*] Verifying directory..."
if [ ! -f "package.json" ] || [ ! -d "app" ]; then
    echo "[-] Error: Not in the vulnerable app directory"
    echo "    Please run this script from: /path/to/vulnerable-app/"
    exit 1
fi

echo "[+] Current directory: $(pwd)"

# 2. Check for running server and ask user to stop it manually
echo "[*] Checking for processes on port 3000..."
PID=$(lsof -ti:3000 2>/dev/null)
if [ ! -z "$PID" ]; then
    echo "[!] A Next.js development server is running on port 3000 (PID: $PID)"
    echo ""
    echo "    Please stop it manually with Ctrl+C in its terminal."
    echo ""
    read -p "[!] Press Enter AFTER you have stopped the server to continue, or Ctrl+C to cancel..."
    
    # Verify it's actually stopped
    sleep 2
    if lsof -ti:3000 2>/dev/null > /dev/null; then
        echo "[-] Server is still running. Please stop it manually and try again."
        exit 1
    else
        echo "[+] Server confirmed stopped"
    fi
else
    echo "[*] No process found on port 3000"
fi

# 3. Ask for confirmation before restoring files
echo ""
echo "[!] This script will restore ONLY the vulnerable app files:"
echo "    - app/page.tsx (main dashboard)"
echo "    - app/actions.ts (server actions)"
echo "    - app/layout.tsx (layout)"
echo ""
echo "    Your custom files will NOT be touched:"
echo "    - exploit/ directory (your exploit)"
echo "    - scripts/ directory (your scripts)"
echo "    - restore.sh (this script)"
echo "    - react2shell.py"
echo ""

read -p "[!] Restore app files to original state? (y/N): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
    echo "[*] Restoration cancelled"
    exit 0
fi

# 4. Backup current page.tsx if it doesn't exist
if [ ! -f "app/page.tsx.backup" ] && [ -f "app/page.tsx" ]; then
    echo "[*] Creating backup of current page.tsx..."
    cp app/page.tsx app/page.tsx.backup
    echo "[+] Backup saved as app/page.tsx.backup"
fi

# 5. Restore from git if available (but only specific files)
if [ -d ".git" ]; then
    echo "[*] Git detected, restoring app files from repository..."
    
    # Restore only the app directory files
    git checkout HEAD -- app/page.tsx 2>/dev/null
    git checkout HEAD -- app/actions.ts 2>/dev/null
    git checkout HEAD -- app/layout.tsx 2>/dev/null
    
    echo "[+] App files restored from git"
    
# 6. If no git, try to clone original temporarily
else
    echo "[*] Git not detected. Downloading original files from GitHub..."
    
    # Create temp directory
    TMP_DIR=$(mktemp -d)
    
    # Clone original repository
    git clone https://github.com/zack0x01/vuln-app-CVE-2025-55182.git "$TMP_DIR" > /dev/null 2>&1
    
    if [ $? -eq 0 ]; then
        # Copy only the app files from the original
        cp "$TMP_DIR/app/page.tsx" app/page.tsx 2>/dev/null
        cp "$TMP_DIR/app/actions.ts" app/actions.ts 2>/dev/null
        cp "$TMP_DIR/app/layout.tsx" app/layout.tsx 2>/dev/null
        
        echo "[+] App files restored from original repository"
    else
        echo "[-] Failed to clone original repository"
        echo "    Your files remain unchanged"
    fi
    
    # Clean up temp directory
    rm -rf "$TMP_DIR"
fi

# 7. Clean Next.js cache (safe)
echo "[*] Cleaning cache..."
rm -rf .next
echo "[+] Cache cleaned"

# 8. Verify node_modules (but don't force reinstall)
if [ ! -d "node_modules" ]; then
    echo "[*] node_modules not found. Installing dependencies..."
    npm install --legacy-peer-deps > /dev/null 2>&1
    echo "[+] Dependencies installed"
else
    echo "[*] node_modules found, skipping installation"
fi

# 9. Final message
echo ""
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║  [+] LABORATORY FULLY RESTORED                               ║"
echo "║                                                              ║"
echo "║  To start the vulnerable server:                             ║"
echo "║  $ npm run dev                                               ║"
echo "║                                                              ║"
echo "║  App will be available at: http://localhost:3000             ║"
echo "╚══════════════════════════════════════════════════════════════╝"

# 10. Optional: Offer to start the server
echo ""
read -p "[!] Do you want to start the server now? (y/N): " start_server
if [[ "$start_server" =~ ^[Yy]$ ]]; then
    echo "[*] Starting development server..."
    npm run dev
fi