Skip to content
WETNav

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.

Worst caseLow

Switches

/all

Shows the user, SID, groups, privileges and logon ID in one output.

Low
/priv

Lists the privileges held by the current token, for example SeDebugPrivilege or SeImpersonatePrivilege.

Low
/groups

Lists group memberships, including integrity level and admin groups.

Low
/user

Shows the user name and SID.

Info
/upn

Shows the user principal name. Only works for domain accounts.

Info
/fqdn

Shows the fully qualified distinguished name of the account. Only works for domain accounts.

Info
/fo<value>

Sets the output format: table, list or csv.

Info

Command 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 regexwhoami(\.exe)?\s+.*\/(all|priv)\b

    T1033

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.

  • Critical
    Renamed Whoami Execution

    Detects the execution of whoami that has been renamed to a different name to avoid detection

    T1033by Florian Roth (Nextron Systems)

  • Critical
    Suspicious 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)

  • High
    Potential 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

  • High
    Security 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)

  • High
    Suspicious Child Process Of Manage Engine ServiceDesk

    Detects suspicious child processes of the "Manage Engine ServiceDesk Plus" Java web service

    T1102by Florian Roth (Nextron Systems)

  • High
    Suspicious Child Process Of Wermgr.EXE

    Detects suspicious Windows Error Reporting manager (wermgr.exe) child process

    T1055T1036by Florian Roth (Nextron Systems)

  • High
    Suspicious 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

  • High
    Suspicious Processes Spawned by WinRM

    Detects suspicious processes including shells spawnd from WinRM host process

    T1190by Andreas Hunkeler (@Karneades), Markus Neis

  • High
    Suspicious Shells Spawn by Java Utility Keytool

    Detects suspicious shell spawn from Java utility keytool process (e.g. adselfservice plus exploitation)

    by Andreas Hunkeler (@Karneades)

  • High
    Suspicious Spool Service Child Process

    Detects suspicious print spool service (spoolsv.exe) child processes.

    T1203T1068by Justin C. (@endisphotic), @dreadphones (detection), Thomas Patzke (Sigma rule)

  • High
    Webshell 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

  • High
    Whoami.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

  • Medium
    Enumerate All Information With Whoami.EXE

    Detects the execution of "whoami.exe" with the "/all" flag

    T1033by Florian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)

  • Medium
    Group 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)

  • Medium
    Suspicious 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)

  • Medium
    Whoami.EXE Execution Anomaly

    Detects the execution of whoami.exe with suspicious parent processes.

    T1033by Florian Roth (Nextron Systems)

  • Medium
    Whoami.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)

  • Low
    Local 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.