Detect D-Link DIR-X1860Z routerd hexString2bin Stack Buffer Overflow (CVE-2026-138278) in Splunk
CVE-2026-138278 is a stack-based buffer overflow (CWE-119, CWE-121) in the hexString2bin function of liblubus.so used by the routerd daemon on D-Link DIR-X1860Z routers, firmware 1.0.7.260821.161908. The function parses an attacker-supplied hex-encoded key_index argument into a fixed-size buffer without bounds checking. The attack can be launched remotely. NVD lists a CVSS 4.0 base score of 9.3 and notes the exploit has been published. Detection focuses on perimeter and network telemetry: HTTP/ubus requests with oversized or malformed hex parameters to router management endpoints, router syslog evidence of routerd crashes, and downstream indicators of compromise on edge devices.
MITRE ATT&CK
SPL Detection Query
``` df00tech DF00-81b6bc2bb2 · https://df00tech.com/detections/CVE-2026-138278 · licence: https://df00tech.com/detections/licence ```
index=network (vendor="D-Link" OR dest_product="DIR-X1860Z" OR uri_path IN ("/ubus","/HNAP1","/goform/*","/cgi-bin/*"))
| eval hex_match=if(match(uri_query,"(?i)(hex|bin|hexstr|data)=[0-9a-fA-F]{400,}"),1,0)
| eval long_hex=if(match(uri_query,"[0-9a-fA-F]{512,}"),1,0)
| where hex_match=1 OR long_hex=1
| stats count AS attempts, values(uri_path) AS paths, values(uri_query) AS sample_queries by src_ip, dest_ip
| where attempts>=1 Identifies Splunk-indexed firewall/proxy records where requests to DIR-X1860Z management paths contain abnormally long hex parameters.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Legitimate config backup/restore operations carrying hex blobs
- Automated vulnerability scanners targeting the device
- Firmware distribution mechanisms embedding hex payloads
Other platforms for CVE-2026-138278
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.
- Test 1 Oversized hex parameter to ubus endpoint
Expected signal: Firewall/proxy log entry showing a request to /ubus with a >4000-char hex query parameter.
- Test 2 Long hex payload to HNAP management path
Expected signal: Proxy/firewall record of a POST to /HNAP1 with a long hex-encoded body.
- Test 3 cgi-bin hex overflow probe
Expected signal: HTTP GET to /cgi-bin/routerd with an abnormally long hexstr parameter in firewall/proxy logs.
Response Playbook
Triage
- Confirm the destination IP is a D-Link DIR-X1860Z running firmware 1.0.7.260821.161908 and that the management interface (ubus/HNAP/goform/cgi-bin) is reachable from the source network.
- Extract and decode the suspicious hex parameter. Measure its decoded length against the expected fixed-size buffer and look for shellcode/ROP-like byte patterns or non-printable payloads.
- Correlate the source IP's request history to determine whether the hex request was a single probe or part of a sustained exploitation sequence, and whether it originated internally or from the internet.
- Check router syslog around the event time for routerd crashes, restarts, or segmentation faults indicating successful memory corruption.
Containment
- Block the source IP at the perimeter firewall and restrict access to the router management plane to a trusted management VLAN only.
- Disable or firewall off remote (WAN-side) management on the DIR-X1860Z and rotate all router administrative credentials.
- If compromise is suspected, isolate the router from the network and prepare for firmware reflash to a vendor-patched version.
Evidence Collection
- Capture full packet capture or proxy logs of the offending requests including the complete hex parameter payload.
- Export router syslog, crash logs, and running configuration (if accessible) for forensic comparison against a known-good baseline.
- Preserve firewall/proxy flow records showing the source IP and any subsequent outbound connections from the router.
Escalation Criteria
- !Evidence of routerd crash or restart coinciding with the oversized hex request, indicating successful exploitation.
- !New or anomalous outbound connections from the router (potential C2) or unauthorized configuration/firmware changes following the request.
Investigation Guide
Forensic Artifacts
- >
routerd process crash/segfault entries in router syslog - >
Modified router configuration (NVRAM) or firmware checksum deviations - >
Oversized hex-encoded request bodies in firewall/proxy/packet-capture logs - >
Unexpected listening services or outbound C2 connections from the router IP
Tuning Guidance
Scope the detection to known DIR-X1860Z management IPs to reduce noise, and baseline the normal maximum length of hex parameters in legitimate firmware/config traffic. Raise the hex-length threshold (currently 400-512 chars) if legitimate config backups trigger it, and allowlist known firmware-update servers and authorized vulnerability scanners by source IP. An exploit for this CVE has been published, so treat detections with higher priority and prioritize alerts that also coincide with routerd crash telemetry.
Hunting Queries
Hunts for abnormally long or hex-heavy requests to any D-Link router management endpoint across the environment.
// df00tech DF00-81b6bc2bb2 · https://df00tech.com/detections/CVE-2026-138278 · licence: https://df00tech.com/detections/licence
CommonSecurityLog | where RequestURL has_any ("/ubus","/HNAP1","/goform/","/cgi-bin/") | extend qlen = strlen(RequestURL) | where qlen > 1024 or RequestURL matches regex @"(?i)(hex|bin|hexstr|data)=[0-9a-fA-F]{400,}" | summarize count() by SourceIP, DestinationIP, bin(TimeGenerated,1h) ``` df00tech DF00-81b6bc2bb2 · https://df00tech.com/detections/CVE-2026-138278 · licence: https://df00tech.com/detections/licence ```
index=network (uri_path IN ("/ubus","/HNAP1","/goform/*","/cgi-bin/*")) | eval qlen=len(uri_query) | where qlen>1024 OR match(uri_query,"(?i)(hex|bin|hexstr|data)=[0-9a-fA-F]{400,}") | stats count by src_ip, dest_ip Atomic Red Team Tests
Sends an HTTP request with an over-long hex-encoded parameter to the router's ubus management endpoint to simulate a hexString2bin overflow attempt (lab device only).
Command
python3 -c "import urllib.request; d='41'*2048; urllib.request.urlopen('http://192.168.0.1/ubus?hex='+d, timeout=5)" || true Cleanup
echo 'No cleanup required; no persistent artifact created on the testing host.' Expected Telemetry
Firewall/proxy log entry showing a request to /ubus with a >4000-char hex query parameter.
Expected Detection
KQL/SPL rules fire on the oversized hex parameter to the management endpoint.
Posts a large hex blob to the /HNAP1 endpoint to mimic exploitation traffic patterns against the DIR-X1860Z (lab only).
Command
curl -s -m 5 -X POST 'http://192.168.0.1/HNAP1' --data "data=$(python3 -c \"print('ab'*1024)\")" || true Cleanup
echo 'No persistent changes; nothing to clean up.' Expected Telemetry
Proxy/firewall record of a POST to /HNAP1 with a long hex-encoded body.
Expected Detection
Network detections match the hex payload length/pattern heuristic.
Simulates a probing request carrying a long hex string to a cgi-bin endpoint associated with routerd handling (lab only).
Command
wget -q -T 5 -O /dev/null "http://192.168.0.1/cgi-bin/routerd?hexstr=$(python3 -c 'print(\"de\"*1500)')" || true Cleanup
echo 'No cleanup needed.' Expected Telemetry
HTTP GET to /cgi-bin/routerd with an abnormally long hexstr parameter in firewall/proxy logs.
Expected Detection
Detection rules flag the oversized hexstr parameter against a router management path.