endpoint(opens in a new tab or window)
system(opens in a new tab or window)
process where host.os.type == "windows" and event.type == "start" and process.name : "whoami.exe" and
(
(
/* scoped for whoami execution under system privileges */
(
(
user.domain : ("NT *", "* NT", "IIS APPPOOL") and
user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20", "S-1-5-82-*") and
not ?winlog.event_data.SubjectUserName : "*$" and
/* Sysmon will always populate user.id as S-1-5-18, leading to FPs */
not event.dataset : ("windows.sysmon_operational", "windows.sysmon")
) or
(?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System")
) and
not (
process.parent.name : "cmd.exe" and
process.parent.args : (
"chcp 437>nul 2>&1 & C:\\WINDOWS\\System32\\whoami.exe /groups",
"chcp 437>nul 2>&1 & %systemroot%\\system32\\whoami /user",
"C:\\WINDOWS\\System32\\whoami.exe /groups",
"*WINDOWS\\system32\\config\\systemprofile*"
)
) and
not (process.parent.executable : "C:\\Windows\\system32\\inetsrv\\appcmd.exe" and process.parent.args : "LIST") and
not process.parent.executable : (
"C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe",
"C:\\Program Files\\Cohesity\\cohesity_windows_agent_service.exe"
)
) or
process.parent.name : ("wsmprovhost.exe", "w3wp.exe", "wmiprvse.exe", "rundll32.exe", "regsvr32.exe")
)
Install detection rules in Elastic Security
Detect Whoami Process Activity in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).