Discovery · Windows
whoami.exe
whoami
Prints the current user, groups and privileges. It is one of the first commands run after initial access or privilege escalation, so a run from an unusual parent is a useful early signal.
Legitimate use
Admins and scripts use it to confirm the account and token a session is running under.
Switches
Shows the user, SID, groups, privileges and logon ID in one output.
LowLists the privileges held by the current token, for example SeDebugPrivilege or SeImpersonatePrivilege.
LowLists group memberships, including integrity level and admin groups.
LowShows the user name and SID.
InfoShows the user principal name. Only works for domain accounts.
InfoShows the fully qualified distinguished name of the account. Only works for domain accounts.
InfoSets the output format: table, list or csv.
InfoCommand lines to worry about
- Low
Token and privilege enumeration
Checks which privileges the session holds. Look at the parent process. A web server, SQL Server or Office parent points to post-exploitation.
Detection regex
whoami(\.exe)?\s+.*\/(all|priv)\b
Where it is recorded
- Security4688Process creation with the full command line, when command-line auditing is enabled.
- Sysmon1Process creation with command line, hashes and parent process.
Community detections
18 SigmaHQ rules for whoami.exe. The explainer checks every pasted command line against all of them.
- CriticalRenamed Whoami Execution
Detects the execution of whoami that has been renamed to a different name to avoid detection
T1033by Florian Roth (Nextron Systems)
- CriticalSuspicious Child Process Of Veeam Dabatase
Detects suspicious child processes of the Veeam service process. This could indicate potential RCE or SQL Injection.
by Nasreddine Bencherchali (Nextron Systems)
- HighPotential Process Injection Via Msra.EXE
Detects potential process injection via Microsoft Remote Asssistance (Msra.exe) by looking at suspicious child processes spawned from the aforementioned process. It has been a target used by many threat actors and used for discovery and persistence tactics
T1055by Alexander McDonald
- HighSecurity Privileges Enumeration Via Whoami.EXE
Detects a whoami.exe executed with the /priv command line flag instructing the tool to show all current user privileges. This is often used after a privilege escalation attempt.
T1033by Florian Roth (Nextron Systems)
- HighSuspicious Child Process Of Manage Engine ServiceDesk
Detects suspicious child processes of the "Manage Engine ServiceDesk Plus" Java web service
T1102by Florian Roth (Nextron Systems)
- HighSuspicious Child Process Of Wermgr.EXE
Detects suspicious Windows Error Reporting manager (wermgr.exe) child process
T1055T1036by Florian Roth (Nextron Systems)
- HighSuspicious Processes Spawned by Java.EXE
Detects suspicious processes spawned from a Java host process which could indicate a sign of exploitation (e.g. log4j)
by Andreas Hunkeler (@Karneades), Florian Roth
- HighSuspicious Processes Spawned by WinRM
Detects suspicious processes including shells spawnd from WinRM host process
T1190by Andreas Hunkeler (@Karneades), Markus Neis
- HighSuspicious Shells Spawn by Java Utility Keytool
Detects suspicious shell spawn from Java utility keytool process (e.g. adselfservice plus exploitation)
by Andreas Hunkeler (@Karneades)
- HighSuspicious Spool Service Child Process
Detects suspicious print spool service (spoolsv.exe) child processes.
T1203T1068by Justin C. (@endisphotic), @dreadphones (detection), Thomas Patzke (Sigma rule)
- HighWebshell Detection With Command Line Keywords
Detects certain command line parameters often used during reconnaissance activity via web shells
T1505.003T1018T1033T1087by Florian Roth (Nextron Systems), Jonhnathan Ribeiro, Anton Kutepov, oscd.community, Chad Hudson, Matt Anderson
- HighWhoami.EXE Execution From Privileged Process
Detects the execution of "whoami.exe" by privileged accounts that are often abused by threat actors
T1033by Florian Roth (Nextron Systems), Teymur Kheirkhabarov
- MediumEnumerate All Information With Whoami.EXE
Detects the execution of "whoami.exe" with the "/all" flag
T1033by Florian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)
- MediumGroup Membership Reconnaissance Via Whoami.EXE
Detects the execution of whoami.exe with the /group command line flag to show group membership for the current user, account type, security identifiers (SID), and attributes.
T1033by Nasreddine Bencherchali (Nextron Systems)
- MediumSuspicious Electron Application Child Processes
Detects suspicious child processes of electron apps (teams, discord, slack, etc.). This could be a potential sign of ".asar" file tampering (See reference section for more information) or binary execution proxy through specific CLI arguments (see related rule)
by Nasreddine Bencherchali (Nextron Systems)
- MediumWhoami.EXE Execution Anomaly
Detects the execution of whoami.exe with suspicious parent processes.
T1033by Florian Roth (Nextron Systems)
- MediumWhoami.EXE Execution With Output Option
Detects the execution of "whoami.exe" with the "/FO" flag to choose CSV as output format or with redirection options to export the results to a file for later use.
T1033by Florian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)
- LowLocal Accounts Discovery
Local accounts, System Owner/User discovery using operating systems utilities
T1033T1087.001by Timur Zinniatullin, Daniil Yugoslavskiy, oscd.community
Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.