Skip to content
CVE-2026-132139 Microsoft Sentinel · KQL

Detect DrayTek Vigor2960 setSWMProfile Stack Buffer Overflow (CVE-2026-132139) in Microsoft Sentinel

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.

Based on DrayTek Vigor2960 Security Analysis, DRV2960-0021 authenticated setSWMProfile filename stack overflow

MITRE ATT&CK

Tactic
Initial Access Execution

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
// df00tech DF00-f703e50db8 · https://df00tech.com/detections/CVE-2026-132139 · licence: https://df00tech.com/detections/licence
let longThreshold = 512;
let suspectUA = dynamic(["curl","python-requests","python-urllib","Go-http-client","libwww-perl"]);
CommonSecurityLog
| where DeviceVendor has "DrayTek" or DeviceProduct has "Vigor" or RequestURL has "mainfunction.cgi"
| where RequestURL has "/cgi-bin/mainfunction.cgi"
| extend reqBody = coalesce(column_ifexists("RequestContext",""), AdditionalExtensions)
| where RequestURL has "setSWMProfile" or reqBody has "setSWMProfile"
| extend bodyLen = strlen(reqBody), urlLen = strlen(RequestURL)
| where bodyLen > longThreshold or urlLen > longThreshold or reqBody has "filename=" and strlen(extract(@"filename=([^&\s]+)", 1, reqBody)) > 256
| extend SuspectClient = iff(RequestClientApplication in~ (suspectUA), true, false)
| project TimeGenerated, SourceIP, DestinationIP, RequestURL, RequestMethod, bodyLen, urlLen, RequestClientApplication, SuspectClient, DeviceVendor, DeviceProduct
| sort by TimeGenerated desc
critical severity medium confidence

Flags HTTP requests to DrayTek Vigor2960 mainfunction.cgi invoking the setSWMProfile action with oversized URL/body or an overlong filename parameter indicative of a stack overflow attempt.

Data Sources

Network Firewall/WAF logs (CEF)DrayTek syslogWeb proxy

Required Tables

CommonSecurityLog

False Positives & Tuning

  • Legitimate administrators saving large SWM (Switch Management) profiles with long but valid names
  • Vulnerability scanners (Nessus, Qualys) probing mainfunction.cgi during authorized assessments
  • Automation/backup tools posting large configuration payloads to the management CGI

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.

  1. 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.

  2. Test 2 Oversized setSWMProfile via GET query (lab)

    Expected signal: HTTP GET log entry with URL length >512 bytes targeting mainfunction.cgi setSWMProfile.

  3. 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.


Response Playbook

Triage

  1. 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.
  2. 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.
  3. 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.
  4. Check the device management log/syslog for httpd or web-UI process crashes, watchdog restarts, or reboots occurring immediately after the suspect request.

Containment

  1. Block the attacking source IP at the perimeter and restrict management-interface (HTTP/HTTPS) access to a trusted administrative subnet or VPN only.
  2. Disable WAN-side access to the web management interface and, if compromise is suspected, isolate the device from the network pending forensic review.
  3. Rotate all administrative credentials for the affected device, since the vulnerability requires authentication and credentials may be compromised.

Evidence Collection

  1. Capture full packet/proxy logs of the malicious requests including headers, body, and the oversized setSWMProfile parameter for the overflow payload.
  2. Export the device configuration, syslog, and crash/reboot history before remediation to preserve evidence of exploitation and any attacker-made config changes.
  3. 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.

Hunting — KQL
kql
// 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
Hunting — SPL
spl
``` 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

Test 1 Oversized setSWMProfile filename POST (lab)
linux

Sends an authenticated POST to mainfunction.cgi with an overlong filename argument to the setSWMProfile action, simulating the stack overflow trigger.

Command

bash
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

bash
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.

Test 2 Oversized setSWMProfile via GET query (lab)
linux

Delivers the oversized setSWMProfile parameter via URL query string to test URL-length-based detection.

Command

bash
curl -sk -b 'sessionid=LAB_SESSION' 'https://192.0.2.10/cgi-bin/mainfunction.cgi?action=setSWMProfile&filename='$(python3 -c 'print("B"*700)')

Cleanup

bash
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.

Test 3 Repeated setSWMProfile crash loop probe (lab)
linux

Issues multiple oversized setSWMProfile requests in succession to simulate repeated overflow attempts and resulting device crash/restart telemetry.

Command

bash
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

bash
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.

Related Detections