Password Change on Directory Service Restore Mode (DSRM) Account

The Directory Service Restore Mode (DSRM) account is a local administrator account on Domain Controllers. Attackers may change the password to gain persistence.

Rule Content

- title: Password Change on Directory Service Restore Mode (DSRM) Account
  id: 53ad8e36-f573-46bf-97e4-15ba5bf4bb51
  status: stable
  description: The Directory Service Restore Mode (DSRM) account is a local administrator
    account on Domain Controllers. Attackers may change the password to gain persistence.
  references:
  - https://adsecurity.org/?p=1714
  author: Thomas Patzke
  tags:
  - attack.persistence
  - attack.privilege_escalation
  - attack.t1098
  logsource:
    product: windows
    service: security
    category: null
  detection:
    selection:
      EventID: 4794
    condition: selection
  falsepositives:
  - Initial installation of a domain controller
  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:"4794"')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()