Skip to content
Threat Feed
low advisory

Linux System User Discovery via Whoami

This detection brief addresses the use of the 'whoami' command on Linux systems for post-exploitation reconnaissance to identify user identity and privilege levels.

The 'whoami' command is a standard utility on Linux systems used to display the username of the current effective user. Threat actors frequently leverage this command during the initial stages of a compromise to confirm their user context and assess the feasibility of privilege escalation. While commonly found in automated scripts and administrative tasks, unauthorized or anomalous execution of 'whoami' serves as a high-fidelity indicator of discovery-phase activity. Detection engineering teams should monitor Linux Auditd SYSCALL events to identify instances of this process being invoked, allowing security operations centers to correlate such behavior with potential lateral movement or persistence attempts.

Attack Chain

  1. Attacker gains initial access to a Linux endpoint through exploitation or credential compromise.
  2. The attacker establishes an interactive shell or remote command execution capability.
  3. Attacker executes 'whoami' to verify the current session's user identity.
  4. Attacker performs secondary discovery (e.g., 'id', 'hostname', 'uname -a') to fingerprint the environment.
  5. Based on the returned user context, the attacker identifies potential privilege escalation vectors.
  6. Attacker executes privilege escalation tools or exploits vulnerable binaries.
  7. Attacker achieves elevated privileges to conduct further malicious actions, such as data exfiltration or persistence installation.

Impact

Successful reconnaissance allows attackers to refine their offensive operations, minimizing noise and increasing the probability of successful privilege escalation. This discovery activity typically precedes unauthorized access to sensitive data, installation of rootkits, or the deployment of ransomware within Linux environments.

Recommendation

  • Deploy the Sigma rule below to monitor Linux Auditd logs for 'whoami' execution.
  • Establish a baseline of legitimate administrative scripts that utilize 'whoami' to minimize false positives.
  • Incorporate the detection of 'whoami' into existing threat hunting playbooks focusing on the MITRE ATT&CK Discovery tactic (T1033).
  • Ensure Linux Auditd is configured to capture SYSCALL, EXECVE, and PROCTITLE events to support process-level visibility.

Immediate actions

Implement the provided Sigma rule in the SIEM.

Detection Engineering 7d

Threat Hunt

Search for whoami execution combined with other discovery tools (id, hostname, uname).

T1033 medium high confidence convert to detection

Data: Auditd process logs

Mitigations

Restrict command execution permissions for non-privileged service accounts.

medium_term IT Operations

T1033

Detection coverage 1

Detect Linux Whoami Execution

low

Detects the execution of the whoami command, a common indicator of user discovery during the reconnaissance phase of an attack.

sigma tactics: discovery techniques: T1033 sources: process_creation, linux

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