Skip to content
Threat Feed
high advisory

Detection of Linux Privilege Escalation via UID 0 Assignment

Attackers may assign a UID of 0 to a non-privileged user account using the 'usermod' utility to establish persistent root-level access on Linux systems.

The 'usermod' utility is a standard Linux administrative tool used to modify existing user accounts. Attackers can leverage this utility to elevate a non-privileged account to root status by modifying the user's User ID (UID) to 0. In Linux systems, the UID 0 is reserved for the root user, granting full administrative privileges regardless of the username.

This technique provides a stealthy method for privilege escalation and persistence. Because the account name may remain unchanged, it may bypass security controls or monitoring tools that track specific administrative usernames rather than observing the underlying UID modification. Legitimate administrative use of 'usermod' to assign UID 0 to a standard user is extremely rare, making this behavior a high-fidelity indicator of malicious activity or significant policy violation. Defenders should investigate the context of such commands immediately.

Impact

Successful execution of this technique results in immediate privilege escalation to root-level access. This allows an attacker to maintain persistent, unrestricted access to the target host, modify system configuration, disable security tools, and access sensitive data. This technique facilitates further post-exploitation activities and poses a severe risk to system integrity.

Recommendation

  • Deploy the Sigma rule below to detect any instance of 'usermod' being used to assign UID 0.
  • Establish an alert for any execution of the 'usermod' binary with the -u or --uid flags.
  • Validate any detected activity against existing change management systems to identify authorized administrative actions.
  • Enable Sysmon for Linux process-creation logging to ensure the command-line arguments are captured in your telemetry.

Immediate actions

Implement the Sigma rule to monitor for UID 0 assignments

Detection Engineering 48h

Mitigations

Restrict sudo access and usermod binary execution to authorized administrators only

medium_term IT Operations

T1548.001

Detection coverage 1

Detect Linux usermod UID 0 Assignment

high

Detects the use of the usermod utility to assign a UID of 0, effectively granting root privileges to a non-root user.

sigma tactics: persistence, privilege-escalation techniques: T1548.001 sources: process_creation, linux

Detection queries are available on the platform. Get full rules →