RDP Login from localhost

RDP login with localhost source address may be a tunnelled login

Rule Content

- title: RDP Login from localhost
  id: 51e33403-2a37-4d66-a574-1fda1782cc31
  description: RDP login with localhost source address may be a tunnelled login
  references:
  - https://www.fireeye.com/blog/threat-research/2019/01/bypassing-network-restrictions-through-rdp-tunneling.html
  date: 2019/01/28
  modified: 2019/01/29
  tags:
  - attack.lateral_movement
  - attack.t1076
  - car.2013-07-002
  status: experimental
  author: Thomas Patzke
  logsource:
    product: windows
    service: security
    category: null
  detection:
    selection:
      EventID: 4624
      LogonType: 10
      SourceNetworkAddress:
      - ::1
      - 127.0.0.1
    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-endpoint-winevent-security-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='(event_id:"4624" AND logon_type:"10" AND SourceNetworkAddress:("\:\:1" OR "127.0.0.1"))')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()