CVE-2024-31041

7.5 HIGH

📋 TL;DR

A null pointer dereference vulnerability in NanoMQ's topic_filtern function allows attackers to crash the MQTT broker by sending specially crafted messages. This affects all systems running vulnerable versions of NanoMQ, potentially disrupting IoT and messaging services.

💻 Affected Systems

Products:
  • NanoMQ
Versions: 0.21.7 and earlier
Operating Systems: All platforms running NanoMQ
Default Config Vulnerable: ⚠️ Yes
Notes: All NanoMQ deployments with MQTT protocol enabled are vulnerable

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete denial of service causing NanoMQ broker crash and service disruption for all connected clients

🟠

Likely Case

Service interruption requiring broker restart, potentially losing in-flight messages

🟢

If Mitigated

Minimal impact if behind load balancer with automatic failover and message persistence

🌐 Internet-Facing: HIGH - Attackers can exploit remotely without authentication
🏢 Internal Only: MEDIUM - Requires network access but no authentication

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending malformed MQTT packets to trigger the null pointer dereference

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.21.8 or later

Vendor Advisory: https://github.com/nanomq/nanomq/issues/1723

Restart Required: Yes

Instructions:

1. Download NanoMQ 0.21.8+ from official repository. 2. Stop current NanoMQ service. 3. Replace binary with patched version. 4. Restart NanoMQ service.

🔧 Temporary Workarounds

Network Segmentation

linux

Restrict MQTT port access to trusted clients only

iptables -A INPUT -p tcp --dport 1883 -s trusted_network -j ACCEPT
iptables -A INPUT -p tcp --dport 1883 -j DROP

🧯 If You Can't Patch

  • Deploy behind reverse proxy with request filtering
  • Implement monitoring and automatic restart for NanoMQ crashes

🔍 How to Verify

Check if Vulnerable:

Check NanoMQ version: nanomq --version

Check Version:

nanomq --version

Verify Fix Applied:

Confirm version is 0.21.8 or later and test with MQTT client sending various topic patterns

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault
  • Null pointer dereference
  • Unexpected broker termination

Network Indicators:

  • Unusual MQTT packet patterns
  • Multiple connection attempts with malformed topics

SIEM Query:

source="nanomq.log" AND ("segmentation fault" OR "null pointer" OR "crash")

🔗 References

📤 Share & Export