CVE-2025-66176
Executive Summary
CVE-2025-66176 is a critical stack overflow vulnerability in the Search and Discovery feature of Hikvision Access Control Products. An unauthenticated attacker on the same local area network (LAN) can send specially crafted packets to trigger a stack overflow, causing device malfunction or potential remote code execution. With a CVSS score of 8.8, this vulnerability poses a high risk to physical security infrastructure. No public exploit code or patch is currently available, making detection and mitigation essential.
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
Supply Chain & Package Security
This vulnerability is not related to NPM, PyPI, Go, or Ruby packages. It affects embedded firmware on Hikvision hardware, specifically access control panels and controllers.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Base Score: 8.8 (High)
- Attack Vector (AV): Adjacent Network (AV:A) – attacker must be on the same LAN.
- Attack Complexity (AC): Low (AC:L) – no special conditions required.
- Privileges Required (PR): None (PR:N) – no authentication needed.
- User Interaction (UI): None (UI:N) – no user action required.
- Scope (S): Unchanged (S:U) – vulnerability does not affect other components.
- Confidentiality (C): High (C:H) – potential data exposure.
- Integrity (I): High (I:H) – potential data modification.
- Availability (A): High (A:H) – device malfunction or crash.
Threat Level: High. Exploitation could lead to full device compromise, lateral movement, and disruption of physical access control systems.
Deep Dive & Mechanics
The vulnerability resides in the Search and Discovery service, which listens for broadcast or multicast packets on the local network. This service is used for device discovery by management software. The stack overflow occurs when parsing specially crafted packets with oversized fields (e.g., device name, serial number, or IP address) that exceed the allocated buffer size.
Root Cause: Lack of input validation and bounds checking in the packet parsing routine. When a packet with a field length greater than the stack buffer is received, the overflow overwrites the return address and other stack data.
Attack Vector: An attacker on the same LAN sends a UDP or TCP packet to the vulnerable service port (commonly port 8000 or 37020). The packet contains a malicious payload that triggers the overflow.
Impact: Successful exploitation can cause:
- Denial of service (device crash/reboot)
- Remote code execution with device privileges
- Persistence via firmware modification
- Lateral movement to other network segments
Vulnerable vs. Patched Code
Since no patch is available, a hypothetical vulnerable code snippet is provided for analysis.
Vulnerable Code (C):
void process_discovery_packet(char *packet) {
char buffer[256];
char *device_name = extract_field(packet, "name");
// No bounds check
strcpy(buffer, device_name);
// ... process buffer
}
Patched Code (Hypothetical):
void process_discovery_packet(char *packet) {
char buffer[256];
char *device_name = extract_field(packet, "name");
if (strlen(device_name) >= sizeof(buffer)) {
log_error("Device name too long");
return;
}
strcpy(buffer, device_name);
// ... process buffer
}
The patched version adds a length check before copying data into the stack buffer, preventing overflow.
Exploitation & Lab Setup
Red Team
Lab Environment:
- Hikvision Access Control device (e.g., DS-K1Txxx series) on isolated LAN
- Attacker machine (Kali Linux) on same LAN
- Network monitoring tools (Wireshark, tcpdump)
Exploitation Steps:
- Identify the target device IP via network scan (e.g.,
nmap -sU -p 37020 192.168.1.0/24). - Craft a malicious packet with an oversized field (e.g., device name > 256 bytes).
- Send the packet using a custom Python script:
import socket
import struct
target_ip = "192.168.1.100"
port = 37020
# Craft malicious payload
payload = b"A" * 300 # Overflow buffer
packet = struct.pack("!H", len(payload)) + payload
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(packet, (target_ip, port))
sock.close()
- Observe device crash or execute shellcode for RCE.
Note: No public exploit code is available; this is a conceptual demonstration.
Blue Team
Detection Steps:
- Monitor for unusually large packets on port 37020/UDP or 8000/TCP.
- Alert on repeated connection attempts from unknown MAC addresses.
- Enable device logging and review for crash events.
- Use network segmentation to isolate access control devices.
Indicators of Compromise (IOCs)
- Network IOCs:
- UDP packets to port 37020 with payload size > 256 bytes
- TCP packets to port 8000 with oversized fields
- Repeated connection attempts from same source IP
- Host IOCs:
- Device crash logs (e.g., "Stack overflow detected")
- Unexpected device reboots
- Modified firmware or configuration files
- File IOCs:
- Malicious packet captures (pcap files) with oversized fields
Detection Engineering
YARA Rule
rule CVE_2025_66176_StackOverflow {
meta:
description = "Detects packets targeting Hikvision Access Control Search and Discovery vulnerability"
author = "Valters IT"
date = "2025-04-01"
cve = "CVE-2025-66176"
strings:
$s1 = "name" ascii wide nocase
$s2 = "serial" ascii wide nocase
$s3 = "ip" ascii wide nocase
condition:
(uint16(0) == 0x0200 or uint16(0) == 0x0100) and
any of ($s*) and
filesize > 256
}
Sigma Rule
title: CVE-2025-66176 Hikvision Access Control Stack Overflow
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects oversized packets to Hikvision Access Control devices
author: Valters IT
date: 2025-04-01
logsource:
category: network_connection
product: suricata
detection:
selection:
dest_port:
- 37020
- 8000
ip_protocol: udp
packet_length: '>256'
condition: selection
falsepositives:
- Legitimate large discovery packets (rare)
level: high
Suricata Rule
alert udp any any -> any 37020 (msg:"CVE-2025-66176 Hikvision Access Control Stack Overflow"; content:"|00 01|"; depth:2; byte_test:2,>,256,2; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate Hikvision Access Control devices on a separate VLAN with strict firewall rules.
- Disable the Search and Discovery feature if not required (via device web interface or firmware settings).
- Monitor network traffic for anomalous packets on ports 37020 and 8000.
Long-term Actions: 4. Apply firmware updates from Hikvision when available. 5. Implement network segmentation and access control lists (ACLs). 6. Use intrusion detection systems (IDS) with custom rules for this CVE. 7. Conduct regular vulnerability assessments on OT/IoT devices.
Workaround: If the feature cannot be disabled, restrict access to the device management interface to trusted IPs only.
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.