Netdata
Netdata is a real-time performance monitoring system. The ndsudo SUID binary can be exploited for privilege escalation via PATH hijacking.
Discovery
# Default port (localhost only)
curl -i http://127.0.0.1:19999
# Check version in response header
# Server: Netdata Embedded HTTP Server v1.45.2
# Find ndsudo binary
find / -name ndsudo 2>/dev/null
# /opt/netdata/usr/libexec/netdata/plugins.d/ndsudo
# Check for SUID
ls -la /opt/netdata/usr/libexec/netdata/plugins.d/ndsudo
# -rwsr-x--- 1 root netdata 196K Apr 1 2024 ndsudoCVE-2024-32019 - ndsudo Privilege Escalation
The ndsudo tool shipped with affected versions allows an attacker to run arbitrary programs with root permissions via PATH hijacking.
Vulnerability Type: Untrusted Search Path (CWE-426) / PATH Hijacking
CVSS Score: 8.8 (High)
Affected Versions: >= v1.45.0, < v1.45.3, >= v1.44.0-60, < v1.45.0-169
Reference: https://github.com/netdata/netdata/security/advisories/GHSA-pmhq-4cxq-wj93
Prerequisites
User must be in the
netdatagroup (or have access to execute ndsudo)Or ndsudo has world-executable permissions
Detection
Exploitation
The exploit works by creating a malicious binary named after a command that ndsudo tries to execute (like arcconf), then prepending its directory to PATH.
Step 1: Create malicious binary
Since the target may not have gcc, compile on attacker machine:
Step 2: Exploit PATH hijacking
Alternative Commands
Different ndsudo commands may work depending on installed plugins:
Quick One-Liner
Post-Exploitation Notes
After gaining root, check Netdata config for additional credentials:
References
https://github.com/netdata/netdata/security/advisories/GHSA-pmhq-4cxq-wj93
https://github.com/juanbelin/CVE-2024-32019-POC
Last updated