Skip to main content
Mallory
HighPublic exploitVulnerability

CVE-2025-31701: Unauthenticated RCE in Dahua RPC Upload Handler

Published Jul 23, 2025 · Updated 2 months ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 daysNo mention activity in the last 30 days.
CVSS8.1High · v3.1
EPSS0.87%60th percentile
CISA KEVNoNot listed
In the wildNonePublic exploit, no exploitation reported
IdentifiersCVE-2025-31701CWE-120 · Buffer Copy without Checking Size…

CVE-2025-31701 is a buffer overflow vulnerability in Dahua camera firmware affecting the handler for an undocumented HTTP POST endpoint used for RPC file upload functionality. The vulnerable code copies the value of the HTTP Cseq header into a fixed buffer in the .bss segment using strncpy without proper bounds checking. Because the copy operation does not enforce the destination buffer size, an unauthenticated attacker can send a specially crafted request that overwrites adjacent global data in memory. Reported exploitation details indicate that nearby overwritten objects can include structures containing function pointers used by session-management logic, enabling control-flow hijacking and remote code execution. Where code execution is not achieved, the memory corruption can still crash the service and cause denial of service.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation can lead to unauthenticated remote code execution on affected devices, including full compromise of the camera firmware execution context. The vulnerability can also be used to corrupt process memory and disrupt device services, causing crashes or persistent unavailability. Because the affected product class is security and surveillance equipment, compromise can undermine device integrity and the trustworthiness of monitoring operations.

Mitigation

If you can’t patch tonight, do this now.

Until patched firmware is deployed, restrict network access to affected devices to trusted management networks only, block unneeded access to the vulnerable HTTP interface, and prevent exposure through direct internet reachability, port forwarding, and automatic gateway publishing features. Segment surveillance devices from general user networks, disable unnecessary services where operationally possible, and monitor for abnormal crashes or unexpected device behavior that may indicate exploitation attempts. Mitigations reduce exposure but do not eliminate the underlying memory corruption flaw.

Remediation

Patch, then assume compromise.

Apply Dahua firmware updates that remediate CVE-2025-31701. Reported vendor guidance indicates that affected firmware released before 2025-04-16 is vulnerable and that later firmware versions contain the fix. Administrators should upgrade all affected Dahua IPC, SD, and TPC series devices to vendor-provided patched firmware and verify that unsupported or unpatched devices are removed from service or replaced.

Public exploits

Exploits

3 exploits validated by Mallory's analysis.

View more in app →
dahua-cve-researchRepository contains Python PoC tooling targeting Dahua device vulnerabilities, primarily over the Dahua RPC2 HTTP interface and the DVRIP/binary service. Structure (8 files): - README.md / SECURITY.md: usage, legal disclaimers, and CVE overview. - dahua_auth_bypass.py: dedicated exploit for CVE-2021-33044 and CVE-2021-33045. Implements the two-step RPC2 challenge-response flow against /RPC2_Login, but crafts the response hash using an empty password (MD5("admin:realm:")) to obtain an authenticated admin session. Includes fallback default-credential testing and post-exploitation enumeration via /RPC2 methods (magicBox.getDeviceType/getSoftwareVersion/getSystemInfo and userManager.getUserInfoAll). - dahua_rce.py: DoS/vulnerability-probe for CVE-2025-31700 and CVE-2025-31701. Sends oversized JSON fields to /RPC2_Login (HTTP overflow probe) and an oversized DVRIP frame to TCP/37777 (binary overflow probe). Determines likely vulnerability via crash indicators (timeouts, connection resets, 5xx) and by checking HTTP reachability before/after. - dahua_scanner.py: subnet/host scanner and Dahua fingerprinting utility. Checks open ports, fetches / over HTTP/HTTPS for Dahua signatures, probes /RPC2_Login for realm/random behavior, and includes logic for auth-bypass/default-cred style checks (full fingerprinting function is truncated in provided content but intent is clear). - dahua_exploit.py: multi-CVE runner combining auth-bypass test, default-credential checks, and buffer-overflow probe logic; file content is partially truncated, but visible portions show the same /RPC2_Login challenge/login flow and a run_all() summary output. Main exploit capabilities: - Network-based authentication bypass to obtain an admin session token on vulnerable firmware (CVE-2021-33044/33045). - Post-authenticated RPC2 enumeration (device type/version/system info and user list) using the obtained session. - Network-based overflow-style malformed input probes over HTTP and TCP/37777 intended to cause crash/DoS and infer potential RCE conditions (CVE-2025-31700/31701), though the provided code is primarily a DoS/vulnerability confirmation rather than a full RCE chain. - Network discovery/fingerprinting and batch testing across subnets and common Dahua ports. Notable targets/endpoints: - HTTP: /RPC2_Login (challenge + login + overflow probe), /RPC2 (authenticated method calls), / (reachability/fingerprinting). - TCP: 37777 (Dahua DVRIP/binary protocol overflow probe). Overall purpose: a small, standalone (non-framework) toolkit for authorized security testing of Dahua cameras/NVR/XVR devices—covering discovery, auth-bypass exploitation with optional data enumeration, and overflow-based DoS/vulnerability probing.umair-aziz025 · Disclosed Mar 3, 2026 · python · network (HTTP RPC2 JSON API abuse for auth bypass and overflow probe) · network (raw TCP to Dahua DVRIP/binary protocol on 37777 for overflow probe) · network scanning/fingerprinting across subnets and common portsOperationalDAHUA_AUTH-BYPASS-CVE-2021-33044This repository is a small standalone Python exploit toolkit for Dahua devices, centered on CVE-2021-33044 authentication bypass. It contains three executable scripts and a README. The main exploit logic is in dahua_auth_bypass.py, which implements the Dahua RPC2 challenge-response flow against /RPC2_Login, derives the MD5-based login hash using an empty password field, and attempts to obtain a valid authenticated session as admin. If successful, it can optionally perform post-auth RPC2 enumeration through /RPC2, including device type, software version, system information, and full user list retrieval. The same script also includes a fallback default-credential check using common Dahua usernames/passwords. The second script, dahua_exploit.py, is a multi-CVE wrapper. From the visible code, it reuses the same RPC2 auth-bypass and default-credential logic, and the README plus code comments indicate an additional buffer-overflow/DoS test path for CVE-2025-31700/CVE-2025-31701. Because the file content is truncated, the exact overflow endpoint and packet structure are not fully visible, but the script clearly positions itself as a combined vulnerability tester rather than a pure single-exploit PoC. The third script, dahua_scanner.py, is a network discovery and fingerprinting utility. It scans user-supplied hosts/subnets and ports, performs TCP connect checks, probes HTTP/HTTPS root pages for Dahua-specific strings, tests /RPC2_Login behavior, and attempts CGI-based fingerprinting via /cgi-bin/magicBox.cgi?action=getDeviceType and getSoftwareVersion. It also contains helper logic for the same RPC2 hash generation and login testing, indicating it can identify vulnerable or weakly configured devices at scale. Overall, the repository purpose is offensive security research and validation of Dahua device exposure: discover devices, identify Dahua services, test for CVE-2021-33044/33045 auth bypass, try default credentials, and enumerate device/user information after access. It is not just a detector; it contains working exploit logic that can produce an authenticated session on vulnerable targets.eagle-nett · Disclosed Mar 24, 2026 · python · markdown · networkOperationalCamera-Dahua-Research-l-h-ng-CVE-2021-33044Repository contains three Python utilities plus a README: (1) dahua_auth_bypass.py is the main exploit PoC for CVE-2021-33044/CVE-2021-33045, (2) dahua_exploit.py is a broader multi-CVE tester, and (3) dahua_scanner.py is a network scanner/fingerprinter for Dahua devices. The core exploit logic targets Dahua HTTP RPC2 authentication by first requesting a login challenge from /RPC2_Login, extracting realm/random/session values, then computing a crafted MD5 hash equivalent to an empty-password login flow. Vulnerable firmware reportedly accepts this hash and returns a valid session ID, enabling authenticated RPC2 calls without knowing the real password. Post-authentication capabilities in dahua_auth_bypass.py include querying device type, software version, system info, and dumping user information via RPC2 methods. The scripts also attempt common default credentials as a fallback on patched devices. The scanner script performs TCP port checks, HTTP/HTTPS fingerprinting using Dahua-specific strings, probes /RPC2_Login for Dahua-style challenge responses, and tries CGI endpoints under /cgi-bin/magicBox.cgi for model/firmware identification. The multi-CVE script additionally references CVE-2025-31700/CVE-2025-31701 as buffer-overflow/DoS tests, but the provided content is truncated, so only its stated purpose can be confirmed. Overall, this is an operational network exploit toolkit for Dahua device discovery, authentication bypass testing, credential checking, and limited post-exploitation enumeration.litndat · Disclosed Jun 24, 2026 · python · markdown · network · webOperational
FAQ

Frequently asked questions

Is CVE-2025-31701 exploited in the wild?
As of Sep 25, 2026, Mallory has no reports of CVE-2025-31701 being exploited in the wild. It is not listed in CISA KEV.
Is there a public exploit for CVE-2025-31701?
Yes. Mallory tracks 3 public exploits or proofs of concept for CVE-2025-31701, the earliest disclosed Mar 3, 2026.
Is there a patch for CVE-2025-31701?
Apply Dahua firmware updates that remediate CVE-2025-31701. Reported vendor guidance indicates that affected firmware released before 2025-04-16 is vulnerable and that later firmware versions contain the fix.
How severe is CVE-2025-31701?
CVE-2025-31701 has a CVSS v3.1 score of 8.1 (High) and an EPSS score of 0.87% (60th percentile) as of Sep 25, 2026.
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidenceEvery report linking this CVE to a named adversary.
Associated malwareMalware families linked to this CVE, with evidence and IOCs.
Detection signaturesYARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity8Community discussion across Reddit, Mastodon, and other social sources.