CVE-2024-42361

7.5 HIGH

📋 TL;DR

CVE-2024-42361 is a SQL injection vulnerability in Hertzbeat's monitoring endpoint that allows attackers to execute arbitrary SQL commands. This affects all Hertzbeat instances running version 1.6.0 or earlier with the vulnerable endpoint exposed. Attackers can potentially read, modify, or delete database contents.

💻 Affected Systems

Products:
  • Hertzbeat
Versions: 1.6.0 and earlier
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: All deployments with the /api/monitor/{monitorId}/metric/{metricFull} endpoint accessible are vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including data exfiltration, data manipulation, privilege escalation, and potential remote code execution through database functions.

🟠

Likely Case

Unauthorized access to monitoring data, extraction of sensitive configuration information, and potential denial of service through database manipulation.

🟢

If Mitigated

Limited impact with proper input validation and parameterized queries preventing SQL injection.

🌐 Internet-Facing: HIGH - The vulnerable endpoint is part of the API and accessible to anyone with network access to the service.
🏢 Internal Only: MEDIUM - Internal attackers or compromised internal systems could exploit this to gain database access.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

SQL injection is well-understood and GitHub Security Lab has published detailed advisories with exploitation details.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.6.1 or later

Vendor Advisory: https://github.com/dromara/hertzbeat/security/advisories

Restart Required: Yes

Instructions:

1. Backup your Hertzbeat configuration and data. 2. Stop the Hertzbeat service. 3. Update to version 1.6.1 or later. 4. Restart the service. 5. Verify the fix by checking the version.

🔧 Temporary Workarounds

Web Application Firewall (WAF)

all

Deploy a WAF with SQL injection protection rules to block malicious requests to the vulnerable endpoint.

Network Access Control

linux

Restrict access to the Hertzbeat API endpoint (/api/monitor/*) to trusted IP addresses only.

iptables -A INPUT -p tcp --dport [hertzbeat-port] -s [trusted-ip] -j ACCEPT
iptables -A INPUT -p tcp --dport [hertzbeat-port] -j DROP

🧯 If You Can't Patch

  • Implement strict input validation and parameterized queries in custom code if modifying source is possible.
  • Monitor and audit all access to the /api/monitor/{monitorId}/metric/{metricFull} endpoint for suspicious activity.

🔍 How to Verify

Check if Vulnerable:

Check if your Hertzbeat version is 1.6.0 or earlier and if the /api/monitor/{monitorId}/metric/{metricFull} endpoint is accessible.

Check Version:

Check the Hertzbeat web interface or configuration files for version information.

Verify Fix Applied:

After updating, verify the version is 1.6.1 or later and test that SQL injection attempts are properly rejected.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL error messages in application logs
  • Multiple rapid requests to /api/monitor/* endpoints
  • Requests with SQL keywords in URL parameters

Network Indicators:

  • Unusual database connection patterns from application server
  • Large data transfers from database to unexpected sources

SIEM Query:

source="hertzbeat" AND (url="/api/monitor/*" AND (param="*SELECT*" OR param="*UNION*" OR param="*OR*"))

🔗 References

📤 Share & Export