CVE-2025-66177
Executive Summary
CVE-2025-66177 is a critical stack overflow vulnerability affecting the Search and Discovery feature of Hikvision NVR, DVR, CVR, and IPC devices. An unauthenticated attacker on the same local area network (LAN) can trigger a stack overflow by sending specially crafted packets, leading to device malfunction or potential remote code execution. The vulnerability has a CVSS score of 8.8, indicating high severity. As of this report, no official patch is available, and no public proof-of-concept (PoC) code has been released. The EPSS score is 0.0%, suggesting low exploitation activity in the wild, but the risk remains significant for unpatched devices in sensitive environments.
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
- CVSS Score: 8.8 (High)
- Attack Vector (AV): Adjacent Network (A) – The attacker must be on the same LAN.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerability does not affect other components.
- Confidentiality (C): High (H) – Potential for full data exposure.
- Integrity (I): High (H) – Potential for data modification.
- Availability (A): High (H) – Potential for denial of service or device crash.
Threat Level: Critical for unpatched devices in internal networks. The lack of a patch and public exploit increases the urgency for defensive measures.
Deep Dive & Mechanics
The vulnerability resides in the Search and Discovery feature of Hikvision devices, which typically uses protocols like UPnP, mDNS, or proprietary discovery mechanisms. The stack overflow occurs when the device processes a specially crafted packet without proper bounds checking on input data. An attacker on the same LAN can send a malicious packet that overflows a stack buffer, potentially overwriting return addresses or other critical data. This can lead to:
- Denial of Service (DoS): Device crash or reboot.
- Remote Code Execution (RCE): If the attacker can control the overflowed data, they may execute arbitrary code with device privileges.
The vulnerability is classified as CWE-121 (Stack-based Buffer Overflow). The exact vulnerable function is not publicly disclosed, but it likely involves parsing of discovery request packets.
Vulnerable vs. Patched Code
Since no patch is available, a direct code comparison is not possible. However, the vulnerable code likely resembles:
void process_discovery_packet(char *packet, int length) {
char buffer[256];
// Vulnerable: no bounds check
strcpy(buffer, packet);
// ... further processing
}
A patched version would include bounds checking:
void process_discovery_packet(char *packet, int length) {
char buffer[256];
if (length > sizeof(buffer) - 1) {
// Handle error
return;
}
strncpy(buffer, packet, sizeof(buffer) - 1);
buffer[sizeof(buffer) - 1] = '\0';
// ... further processing
}
Exploitation & Lab Setup
Red Team
Lab Setup:
- Target: Hikvision NVR/DVR/CVR/IPC device (unpatched) on a local network.
- Attacker Machine: Kali Linux or similar with network access to the target.
- Tools: Python, Scapy, or custom packet crafting tools.
Exploitation Steps:
- Identify the target device IP via network scanning (e.g.,
nmap -sn 192.168.1.0/24). - Craft a malicious discovery packet with a payload that exceeds the buffer size. Example using Python and Scapy:
from scapy.all import *
target_ip = "192.168.1.100"
# Craft a UDP packet to the discovery port (e.g., 3702 for UPnP)
packet = IP(dst=target_ip)/UDP(sport=12345, dport=3702)/Raw(load="A"*500)
send(packet)
- Monitor the device for crash or unexpected behavior. For RCE, the payload would need to include shellcode.
Note: No public exploit is available; this is a conceptual approach.
Blue Team
Detection & Response:
- Network Monitoring: Monitor for unusual discovery packets (e.g., oversized or malformed UPnP/mDNS packets).
- Honeypots: Deploy fake Hikvision devices to detect scanning or exploitation attempts.
- Segmentation: Isolate Hikvision devices on a separate VLAN with strict access controls.
- Patch Management: Continuously monitor for official patches from Hikvision.
Indicators of Compromise (IOCs)
- Network IOCs:
- UDP packets to ports 1900 (UPnP), 5353 (mDNS), or proprietary ports with payloads > 256 bytes.
- Repeated discovery requests from a single source IP.
- Host IOCs:
- Device logs showing unexpected crashes or reboots.
- Unusual processes or memory usage on the device (if accessible).
- File IOCs:
- None specific, as no file-based exploitation is involved.
Detection Engineering
YARA Rule
rule CVE_2025_66177_Hikvision_StackOverflow {
meta:
description = "Detects packets targeting Hikvision discovery stack overflow"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2025-66177"
strings:
$s1 = "M-SEARCH" ascii wide nocase
$s2 = "ST:urn" ascii wide nocase
$s3 = "Hikvision" ascii wide nocase
condition:
uint16(0) == 0x4500 and any of ($s*) and filesize > 256
}
Sigma Rule
title: Hikvision Discovery Stack Overflow Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects oversized discovery packets targeting Hikvision devices
author: Valters IT
date: 2025-04-10
logsource:
category: network
product: suricata
detection:
selection:
dest_port:
- 1900
- 5353
- 3702
payload_length: >256
condition: selection
falsepositives:
- Legitimate large discovery packets (rare)
level: high
Suricata Rule
alert udp any any -> any 1900,5353,3702 (msg:"CVE-2025-66177 Hikvision Discovery Stack Overflow Attempt"; content:"|00 00 00 00|"; depth:4; offset:0; pcre:"/^.{256}/R"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate Hikvision devices on a separate VLAN with strict firewall rules.
- Disable unnecessary discovery features (e.g., UPnP, mDNS) if not required.
- Monitor network traffic for anomalous discovery packets.
Long-term Actions:
- Apply official patches from Hikvision as soon as they are released.
- Implement network segmentation and access controls.
- Regularly update device firmware.
Compensating Controls:
- Deploy intrusion detection systems (IDS) with custom rules for this CVE.
- Use network access control (NAC) to restrict device communication.
Valters IT
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.