Suspicious RDP Redirect Using TSCON

Detects a suspicious RDP session redirect using tscon.exe

Rule Content

- title: Suspicious RDP Redirect Using TSCON
  id: f72aa3e8-49f9-4c7d-bd74-f8ab84ff9bbb
  status: experimental
  description: Detects a suspicious RDP session redirect using tscon.exe
  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
  tags:
  - attack.lateral_movement
  - attack.privilege_escalation
  - attack.t1076
  - car.2013-07-002
  author: Florian Roth
  date: 2018/03/17
  modified: 2018/12/11
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      CommandLine: '* /dest:rdp-tcp:*'
    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='process_command_line.keyword:*\ \/dest\:rdp\-tcp\:*')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()