Windows 10 scheduled task SandboxEscaper 0-day

Detects Task Scheduler .job import arbitrary DACL write\par

Rule Content

- title: Windows 10 scheduled task SandboxEscaper 0-day
  id: 931b6802-d6a6-4267-9ffa-526f57f22aaf
  status: experimental
  description: Detects Task Scheduler .job import arbitrary DACL write\par
  references:
  - https://github.com/SandboxEscaper/polarbearrepo/tree/master/bearlpe
  author: Olaf Hartong
  date: 2019/05/22
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image: schtasks.exe
      CommandLine: '*/change*/TN*/RU*/RP*'
    condition: selection
  falsepositives:
  - Unknown
  tags:
  - attack.privilege_escalation
  - attack.execution
  - attack.t1053
  - car.2013-08-001
  level: high

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

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='(process_path:"schtasks.exe" AND process_command_line.keyword:*\/change*\/TN*\/RU*\/RP*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()