- title: Whoami as LOCAL_SYSTEM
id: 1453b1a4-261b-4daf-afe1-2a400a838b5c
status: experimental
description: Detects the execution of whoami as LOCAL_SYSTEM, often used after privilege
escalation by attackers who want to evaluate the new user context
author: Florian Roth
date: 2019/12/22
tags:
- attack.discovery
- attack.t1033
- car.2016-03-001
logsource:
category: process_creation
product: windows
service: null
detection:
selection:
Image|contains: \whoami.exe
User: NT AUTHORITY\SYSTEM
condition: selection
falsepositives:
- Admin activity
- Scripts and administrative tools used in the monitored environment
level: critical
In [ ]:
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
import pandas as pd
In [ ]:
es = Elasticsearch(['http://helk-elasticsearch:9200'])
searchContext = Search(using=es, index='logs-*', doc_type='doc')
In [ ]:
s = searchContext.query('query_string', query='(process_path.keyword:*\\whoami.exe* AND user_account:"NT\ AUTHORITY\\SYSTEM")')
response = s.execute()
if response.success():
df = pd.DataFrame((d.to_dict() for d in s.scan()))
In [ ]:
df.head()