Eventlog Cleared

One of the Windows Eventlogs has been cleared. e.g. caused by "wevtutil cl" command execution

Rule Content

- title: Eventlog Cleared
  id: d99b79d2-0a6f-4f46-ad8b-260b6e17f982
  description: One of the Windows Eventlogs has been cleared. e.g. caused by "wevtutil
    cl" command execution
  references:
  - https://twitter.com/deviouspolack/status/832535435960209408
  - https://www.hybrid-analysis.com/sample/027cc450ef5f8c5f653329641ec1fed91f694e0d229928963b30f6b0d7d3a745?environmentId=100
  author: Florian Roth
  tags:
  - attack.defense_evasion
  - attack.t1070
  - car.2016-04-002
  logsource:
    product: windows
    service: system
    category: null
  detection:
    selection:
      EventID: 104
      Source: Microsoft-Windows-Eventlog
    condition: selection
  falsepositives:
  - Unknown
  level: medium

Querying Elasticsearch

Import Libraries


In [ ]:
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
import pandas as pd

Initialize Elasticsearch client


In [ ]:
es = Elasticsearch(['http://helk-elasticsearch:9200'])
searchContext = Search(using=es, index='logs-endpoint-winevent-system-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='(event_id:"104" AND source_name:"Microsoft\-Windows\-Eventlog")')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()