Potential Privilege Escalation via unshare Followed by Root Process
The rule detects a sequence of events indicating a potential privilege escalation attempt on Linux systems where a non-root user performs namespace activity using unshare, followed by the execution of a root process shortly after.
This detection rule, created by Elastic on May 8, 2026, identifies potential privilege escalation attempts on Linux systems. It focuses on a specific sequence of events where a non-root user utilizes the unshare command or syscall to manipulate namespaces, a technique often associated with privilege escalation. Shortly after this namespace activity, a process running as root is executed. This sequence raises suspicion as it could indicate a successful privilege escalation attempt, where a user gains unauthorized root access by exploiting namespace vulnerabilities. This is relevant for defenders as it helps detect and prevent unauthorized access and maintain system integrity. The rule relies on Auditd Manager or Auditbeat telemetry.
Attack Chain
- A non-root user executes the
unsharecommand or syscall to create or join a new namespace. This is often done to isolate processes and resources. - The
unsharecommand is executed with arguments like--user,--map-root-user, or--map-current-user, indicating an attempt to manipulate user namespaces. - The Auditd logs capture the
unsharesyscall with class “namespace” and specific arguments (a0) related to namespace manipulation. - Shortly after the
unshareactivity, a process is spawned that executes with root privileges (UID 0). - The root process could be a common utility like
su,sudo,pkexec,passwd,bash, orpython. - The attacker leverages the elevated privileges to perform malicious actions, such as installing malware or modifying system configurations.
- The attacker attempts to establish persistence by modifying system files or creating new user accounts.
- The attacker gains complete control over the compromised system.
Impact
A successful privilege escalation can grant an attacker complete control over a Linux system. This allows them to access sensitive data, install malware, modify system configurations, and potentially compromise other systems on the network. The number of victims depends on the scope of the initial compromise and the attacker’s objectives. Sectors targeted could include any organization running Linux systems, particularly those with sensitive data or critical infrastructure.
Recommendation
- Enable Auditd Manager or Auditbeat with rules that capture process execution events, namespace-related activity, and privilege transitions as described in the rule setup section.
- Deploy the provided Sigma rules to your SIEM to detect potential privilege escalation attempts via
unshare. Tune the rules based on your environment and baseline legitimateunshareusage. - Investigate any alerts generated by these rules promptly. Review the auditd logs, process command lines, and network connections associated with the events to determine if the activity is malicious.
- Implement additional security measures to prevent privilege escalation, such as principle of least privilege and regular security audits.
Detection coverage 2
Detect unshare Command Execution by Non-Root User
mediumDetects execution of the `unshare` command by a non-root user, which may indicate the start of a privilege escalation attempt.
Detect Root Process Started After unshare
highDetects a root process started shortly after an unshare event, potentially indicating privilege escalation.
Detection queries are available on the platform. Get full rules →