Failed Code Integrity Checks

Code integrity failures may indicate tampered executables.

Rule Content

- title: Failed Code Integrity Checks
  id: 470ec5fa-7b4e-4071-b200-4c753100f49b
  status: stable
  description: Code integrity failures may indicate tampered executables.
  author: Thomas Patzke
  tags:
  - attack.defense_evasion
  - attack.t1009
  logsource:
    product: windows
    service: security
    category: null
  detection:
    selection:
      EventID:
      - 5038
      - 6281
    condition: selection
  falsepositives:
  - Disk device errors
  level: low

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-security-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='event_id:("5038" OR "6281")')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()