Detect DrayTek Vigor2960 setSWMProfile Stack Buffer Overflow (CVE-2026-132139) in CrowdStrike LogScale
Detects exploitation attempts against a stack-based buffer overflow (CWE-121/CWE-119) in the setSWMProfile function of /cgi-bin/mainfunction.cgi on DrayTek Vigor2960 routers up to firmware 1.5.1.6. An authenticated attacker supplies an overlong filename argument to the setSWMProfile action, overflowing a fixed-size stack buffer. The write-up shows the overflow overwrites saved registers including pc and lr and crashes the CGI process, so code execution may be possible. The attack can be performed remotely. Detection focuses on HTTP POST/GET requests to mainfunction.cgi carrying a setSWMProfile action with abnormally long parameter values, repeated crashes or restarts of the web management process, and anomalous outbound connections from the device. CVSS 8.6. A public proof-of-concept exploit is available. Firmware 1.5.1.7 addresses the issue.
MITRE ATT&CK
- Tactic
- Initial Access Execution
LogScale Detection Query
// df00tech DF00-f703e50db8 · https://df00tech.com/detections/CVE-2026-132139 · licence: https://df00tech.com/detections/licence
#event_simpleName=NetworkConnectIP4 OR #repo=http_events
| (uri=/\/cgi-bin\/mainfunction\.cgi/ OR RequestUrl=/mainfunction\.cgi/)
| (RequestBody=/setSWMProfile/ OR uri=/setSWMProfile/)
| bodyLen := length(RequestBody)
| urlLen := length(RequestUrl)
| test(bodyLen > 512 OR urlLen > 512)
| groupBy([aid, RemoteAddressIP4, RequestUrl], function=[count(), max(bodyLen, as=maxBodyLen)])
| sort(count, order=desc) CrowdStrike CQL (LogScale) query matching oversized setSWMProfile requests to DrayTek Vigor2960 management CGI.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate large SWM profile configuration
- Authorized vulnerability scanning
- Automated configuration tooling
Other platforms for CVE-2026-132139
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 setSWMProfile filename POST (lab)
Expected signal: HTTP request log to mainfunction.cgi with setSWMProfile and a parameter >512 bytes; possible httpd crash/restart in device syslog.
- Test 2 Oversized setSWMProfile via GET query (lab)
Expected signal: HTTP GET log entry with URL length >512 bytes targeting mainfunction.cgi setSWMProfile.
- Test 3 Repeated setSWMProfile crash loop probe (lab)
Expected signal: Multiple oversized requests plus recurring httpd watchdog restarts/reboots in device syslog within a short window.
References (5)
- https://vuldb.com/cve/CVE-2026-132139
- https://vuldb.com/vuln/439439
- https://vuldb.com/vuln/439439/cti
- https://github.com/yikesoftware/DrayTek_Vigor2960_Security_Analysis/tree/main/cases/DRV2960-0021-authenticated-setswmprofile-filename-stack-overflow
- https://fw.draytek.com.tw/Vigor2960/Firmware/v1.5.1.7/Vigor2960_v1.5.1.7.zip
Response Playbook
Triage
- Confirm the target device is a DrayTek Vigor2960 running firmware 1.5.1.6 or earlier (vulnerable); firmware 1.5.1.7 contains the fix.
- Extract the full request to /cgi-bin/mainfunction.cgi and inspect the setSWMProfile action's filename/parameter length, values exceeding the buffer size (>256 bytes of filename or >512 bytes total) indicate an overflow attempt.
- Determine whether the request was authenticated (the flaw requires valid management credentials); correlate the source IP with known admin sessions and review preceding login events.
- Check the device management log/syslog for httpd or web-UI process crashes, watchdog restarts, or reboots occurring immediately after the suspect request.
Containment
- Block the attacking source IP at the perimeter and restrict management-interface (HTTP/HTTPS) access to a trusted administrative subnet or VPN only.
- Disable WAN-side access to the web management interface and, if compromise is suspected, isolate the device from the network pending forensic review.
- Rotate all administrative credentials for the affected device, since the vulnerability requires authentication and credentials may be compromised.
Evidence Collection
- Capture full packet/proxy logs of the malicious requests including headers, body, and the oversized setSWMProfile parameter for the overflow payload.
- Export the device configuration, syslog, and crash/reboot history before remediation to preserve evidence of exploitation and any attacker-made config changes.
- Preserve firewall, proxy, and NetFlow records showing connections to and any anomalous outbound connections from the device around the event window.
Escalation Criteria
- !Escalate to incident response if device crashes/reboots coincide with the suspect request or if outbound connections from the device to unknown hosts appear (possible RCE/implant).
- !Escalate if the attacking source correlates with an authenticated admin session from an unexpected geolocation or if configuration changes were made following the request.
Investigation Guide
Forensic Artifacts
- >
DrayTek web management (httpd) process crash dumps, watchdog restart entries and reboot timestamps in device syslog - >
HTTP access logs / proxy records containing the oversized setSWMProfile request to mainfunction.cgi - >
Device configuration diffs and any newly created SWM profiles following the suspect request
Tuning Guidance
Baseline the normal maximum length of legitimate setSWMProfile requests in your environment (valid profile names and payloads are typically well under 256 bytes) and adjust the length thresholds to just above that baseline. Whitelist authorized administrator source IPs and approved vulnerability-scanner ranges to reduce noise. If the device is not WAN-exposed, scope the detection to internal management subnets to focus on insider/lateral-movement scenarios.
Hunting Queries
Surfaces hosts sending unusually large setSWMProfile requests to DrayTek management CGI across the environment.
// df00tech DF00-f703e50db8 · https://df00tech.com/detections/CVE-2026-132139 · licence: https://df00tech.com/detections/licence
CommonSecurityLog | where RequestURL has "mainfunction.cgi" and (AdditionalExtensions has "setSWMProfile") | extend L=strlen(AdditionalExtensions) | summarize max(L), count() by SourceIP, DestinationIP | where max_L > 400 ``` df00tech DF00-f703e50db8 · https://df00tech.com/detections/CVE-2026-132139 · licence: https://df00tech.com/detections/licence ```
index=network uri_path="*mainfunction.cgi*" "setSWMProfile" | eval l=len(_raw) | stats max(l) as maxlen count by src_ip dest_ip | where maxlen>400 Atomic Red Team Tests
Sends an authenticated POST to mainfunction.cgi with an overlong filename argument to the setSWMProfile action, simulating the stack overflow trigger.
Command
curl -sk -b 'sessionid=LAB_SESSION' -X POST 'https://192.0.2.10/cgi-bin/mainfunction.cgi' --data "action=setSWMProfile&filename=$(python3 -c 'print("A"*800)')" Cleanup
echo 'No cleanup required; request is non-persistent. Reboot lab device if web UI became unresponsive.' Expected Telemetry
HTTP request log to mainfunction.cgi with setSWMProfile and a parameter >512 bytes; possible httpd crash/restart in device syslog.
Expected Detection
KQL/SPL oversized-request rules fire on the >512 byte setSWMProfile body.
Delivers the oversized setSWMProfile parameter via URL query string to test URL-length-based detection.
Command
curl -sk -b 'sessionid=LAB_SESSION' 'https://192.0.2.10/cgi-bin/mainfunction.cgi?action=setSWMProfile&filename='$(python3 -c 'print("B"*700)') Cleanup
echo 'No cleanup required; non-persistent request.' Expected Telemetry
HTTP GET log entry with URL length >512 bytes targeting mainfunction.cgi setSWMProfile.
Expected Detection
URL-length branch of the detection rules matches the oversized query string.
Issues multiple oversized setSWMProfile requests in succession to simulate repeated overflow attempts and resulting device crash/restart telemetry.
Command
for i in $(seq 1 5); do curl -sk -b 'sessionid=LAB_SESSION' -X POST 'https://192.0.2.10/cgi-bin/mainfunction.cgi' --data "action=setSWMProfile&filename=$(python3 -c 'print("C"*900)')"; sleep 2; done Cleanup
echo 'Reboot the lab device if the management interface remains unresponsive after the loop.' Expected Telemetry
Multiple oversized requests plus recurring httpd watchdog restarts/reboots in device syslog within a short window.
Expected Detection
Aggregation/stats rules flag repeated oversized setSWMProfile requests to the same device.