Skip to content

ndsudo: local privilege escalation via untrusted search path

High
Ferroin published GHSA-pmhq-4cxq-wj93 Apr 12, 2024

Package

ndsudo

Affected versions

>= v1.45.0, < v1.45.3, >= v1.44.0-60, < v1.45.0-169

Patched versions

v1.45.3, v1.45.0-169

Description

Summary

The ndsudo tool shipped with affected versions of the Netdata Agent allows an attacker to run arbitrary programs with root permissions.

Details

The ndsudo tool is packaged as a root-owned executable with the SUID bit set.
It only runs a restricted set of external commands, but its search paths are supplied by the PATH environment variable. This allows an attacker to control where ndsudo looks for these commands, which may be a path the attacker has write access to.

PoC

As a user that has permission to run ndsudo:

  1. Place an executable with a name that is on ndsudo’s list of commands (e.g. nvme) in a writable path
  2. Set the PATH environment variable so that it contains this path
  3. Run ndsudo with a command that will run the aforementioned executable

Impact

Local privilege escalation.

Severity

High
8.8
/ 10

CVSS base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

CVE ID

CVE-2024-32019

Weaknesses

Credits