Secure Deletion with SDelete

Detects renaming of file while deletion with SDelete tool

Rule Content

- title: Secure Deletion with SDelete
  id: 39a80702-d7ca-4a83-b776-525b1f86a36d
  status: experimental
  description: Detects renaming of file while deletion with SDelete tool
  author: Thomas Patzke
  references:
  - https://jpcertcc.github.io/ToolAnalysisResultSheet
  - https://www.jpcert.or.jp/english/pub/sr/ir_research.html
  - https://technet.microsoft.com/en-us/en-en/sysinternals/sdelete.aspx
  tags:
  - attack.defense_evasion
  - attack.t1107
  - attack.t1066
  - attack.s0195
  logsource:
    product: windows
    service: security
    category: null
  detection:
    selection:
      EventID:
      - 4656
      - 4663
      - 4658
      ObjectName:
      - '*.AAA'
      - '*.ZZZ'
    condition: selection
  falsepositives:
  - Legitime usage of SDelete
  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-security-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='(event_id:("4656" OR "4663" OR "4658") AND object_name.keyword:(*.AAA OR *.ZZZ))')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()