Suspicious TSCON Start

Detects a tscon.exe start as LOCAL SYSTEM

Rule Content

- title: Suspicious TSCON Start
  id: 9847f263-4a81-424f-970c-875dab15b79b
  status: experimental
  description: Detects a tscon.exe start as LOCAL SYSTEM
  references:
  - http://www.korznikov.com/2017/03/0-day-or-feature-privilege-escalation.html
  - https://medium.com/@networksecurity/rdp-hijacking-how-to-hijack-rds-and-remoteapp-sessions-transparently-to-move-through-an-da2a1e73a5f6
  author: Florian Roth
  date: 2018/03/17
  tags:
  - attack.command_and_control
  - attack.t1219
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      User: NT AUTHORITY\SYSTEM
      Image: '*\tscon.exe'
    condition: selection
  falsepositives:
  - Unknown
  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='(user_account:"NT\ AUTHORITY\\SYSTEM" AND process_path.keyword:*\\tscon.exe)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()