Detection rules › Elastic

Unusual LDAP Client Process

Time window
1m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies an unusual Windows native process performing LDAP activity. This may indicate an attempt to perform domain discovery using the LDAP protocol.

MITRE ATT&CK coverage

TacticTechniques
Credential Access

Rule body

[rule]
description = """
Identifies an unusual Windows native process performing LDAP activity. This may indicate an attempt to perform domain
discovery using the LDAP protocol.
"""
id = "968e989d-de58-48db-9a06-38a170090def"
license = "Elastic License v2"
name = "Unusual LDAP Client Process"
os_list = ["windows"]
version = "1.0.23"

query = '''
sequence by process.entity_id with maxspan=1m
 [process where event.action == "start" and
  process.executable : ("?:\\Windows\\system32\\*", "?:\\Windows\\SysWOW64\\*") and
  process.parent.name != null and
  process.code_signature.subject_name : "Microsoft *" and 
  not process.name : ("powershell.exe", "powershell_ise.exe", "pwsh.exe") and
  not process.executable : 
            ("?:\\Windows\\AdminArsenal\\PDQInventory-Scanner\\service-1\\exec\\PDQInventoryScanner.exe", 
             "?:\\Windows\\System32\\wbem\\WmiPrvSE.exe", 
             "?:\\Windows\\System32\\inetsrv\\w3wp.exe", 
             "?:\\Windows\\SysWOW64\\inetsrv\\w3wp.exe", 
             "?:\\Windows\\System32\\wsmprovhost.exe", 
             "?:\\Windows\\System32\\Essentials\\SharedServiceHost.exe",
             "?:\\Windows\\System32\\Essentials\\RunTask.exe",
             "?:\\Windows\\System32\\Essentials\\ProviderRegistryService.exe",
             "?:\\Windows\\System32\\mmc.exe", 
             "?:\\Windows\\SysWOW64\\mmc.exe", 
             "?:\\Windows\\System32\\ServerManager.exe", 
             "?:\\Windows\\System32\\dsac.exe", 
             "?:\\Windows\\System32\\Vmw.exe", 
             "?:\\Windows\\SysWOW64\\msiexec.exe", 
             "?:\\Windows\\System32\\msiexec.exe", 
             "?:\\Windows\\System32\\ClusterUpdateUI.exe",
             "?:\\Windows\\System32\\Essentials\\Dashboard.exe",
             "?:\\Windows\\System32\\gpresult.exe",
             "?:\\Windows\\System32\\RAMgmtUI.exe",
             "?:\\Windows\\System32\\LogonUI.exe",
             "?:\\Windows\\System32\\consent.exe",
             "?:\\Windows\\System32\\conhost.exe") and
  not (process.executable :
            ("?:\\Windows\\System32\\dllhost.exe",
             "?:\\Windows\\System32\\taskhost*.exe",
             "?:\\Windows\\SysWOW64\\dllhost.exe",
             "?:\\Windows\\SysWOW64\\taskhost*.exe") and
       process.parent.executable : "?:\\Windows\\System32\\svchost.exe") and
  not (process.name : "dllhost.exe" and process.args : "/Processid:{7F9BBC82-BA5F-4448-8622-EF76B8D007E6}") and
  not (process.name : "rundll32.exe" and
       process.command_line : "*zzzzInvokeManagedCustomActionOutOfProc*" and process.parent.name : "msiexec.exe") and
  not (process.name : ("cscript.exe", "wscript.exe") and
       process.parent.executable : "?:\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe") and
  not (process.code_signature.subject_name : ("PDQ.com Corporation", "ci solution GmbH") and process.code_signature.trusted == true) and
  not (process.executable : "?:\\Windows\\system32\\svchost.exe" and process.args : "gpsvc" and process.parent.name : "services.exe")
  ]
 [library where dll.name : "System.DirectoryServices*.dll"]
 [network where destination.port == 389 and source.port >= 49152 and
  network.direction == "egress" and network.transport == "tcp" and
  not destination.address : ("127.*", "::1")]
'''

min_endpoint_version = "7.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1558"
name = "Steal or Forge Kerberos Tickets"
reference = "https://attack.mitre.org/techniques/T1558/"


[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and
  process.executable : ("?:\\Windows\\system32\\*", "?:\\Windows\\SysWOW64\\*") and
  process.parent.name != null and
  process.code_signature.subject_name : "Microsoft *" and 
  not process.name : ("powershell.exe", "powershell_ise.exe", "pwsh.exe") and
  not process.executable : 
            ("?:\\Windows\\AdminArsenal\\PDQInventory-Scanner\\service-1\\exec\\PDQInventoryScanner.exe", 
             "?:\\Windows\\System32\\wbem\\WmiPrvSE.exe", 
             "?:\\Windows\\System32\\inetsrv\\w3wp.exe", 
             "?:\\Windows\\SysWOW64\\inetsrv\\w3wp.exe", 
             "?:\\Windows\\System32\\wsmprovhost.exe", 
             "?:\\Windows\\System32\\Essentials\\SharedServiceHost.exe",
             "?:\\Windows\\System32\\Essentials\\RunTask.exe",
             "?:\\Windows\\System32\\Essentials\\ProviderRegistryService.exe",
             "?:\\Windows\\System32\\mmc.exe", 
             "?:\\Windows\\SysWOW64\\mmc.exe", 
             "?:\\Windows\\System32\\ServerManager.exe", 
             "?:\\Windows\\System32\\dsac.exe", 
             "?:\\Windows\\System32\\Vmw.exe", 
             "?:\\Windows\\SysWOW64\\msiexec.exe", 
             "?:\\Windows\\System32\\msiexec.exe", 
             "?:\\Windows\\System32\\ClusterUpdateUI.exe",
             "?:\\Windows\\System32\\Essentials\\Dashboard.exe",
             "?:\\Windows\\System32\\gpresult.exe",
             "?:\\Windows\\System32\\RAMgmtUI.exe",
             "?:\\Windows\\System32\\LogonUI.exe",
             "?:\\Windows\\System32\\consent.exe",
             "?:\\Windows\\System32\\conhost.exe") and
  not (process.executable :
            ("?:\\Windows\\System32\\dllhost.exe",
             "?:\\Windows\\System32\\taskhost*.exe",
             "?:\\Windows\\SysWOW64\\dllhost.exe",
             "?:\\Windows\\SysWOW64\\taskhost*.exe") and
       process.parent.executable : "?:\\Windows\\System32\\svchost.exe") and
  not (process.name : "dllhost.exe" and process.args : "/Processid:{7F9BBC82-BA5F-4448-8622-EF76B8D007E6}") and
  not (process.name : "rundll32.exe" and
       process.command_line : "*zzzzInvokeManagedCustomActionOutOfProc*" and process.parent.name : "msiexec.exe") and
  not (process.name : ("cscript.exe", "wscript.exe") and
       process.parent.executable : "?:\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe") and
  not (process.code_signature.subject_name : ("PDQ.com Corporation", "ci solution GmbH") and process.code_signature.trusted == true) and
  not (process.executable : "?:\\Windows\\system32\\svchost.exe" and process.args : "gpsvc" and process.parent.name : "services.exe")
  ]

Stage 2: library

[library where dll.name : "System.DirectoryServices*.dll"]

Stage 3: network

[network where destination.port == 389 and source.port >= 49152 and
  network.direction == "egress" and network.transport == "tcp" and
  not destination.address : ("127.*", "::1")]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq/Processid:{7F9BBC82-BA5F-4448-8622-EF76B8D007E6}excludes:process.args field:"process.args" value:"/Processid:{7F9BBC82-BA5F-4448-8622-EF76B8D007E6}"
process.nameeqdllhost.exeexcludes:process.name field:"process.name" value:"dllhost.exe"
process.argseqgpsvcexcludes:process.args field:"process.args" value:"gpsvc"
process.executableeq?:\Windows\system32\svchost.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\system32\svchost.exe"
process.parent.nameeqservices.exeexcludes:process.parent.name field:"process.parent.name" value:"services.exe"
process.code_signature.subject_nameeqPDQ.com Corporation, ci solution GmbHexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"PDQ.com Corporation" field:"process.code_signature.subject_name" value:"ci solution GmbH"
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.command_linematchzzzzInvokeManagedCustomActionOutOfProcexcludes:process.command_line field:"process.command_line" value:"zzzzInvokeManagedCustomActionOutOfProc"
process.nameeqrundll32.exeexcludes:process.name field:"process.name" value:"rundll32.exe"
process.parent.nameeqmsiexec.exeexcludes:process.parent.name field:"process.parent.name" value:"msiexec.exe"
process.executablewildcard?:\Windows\System32\dllhost.exe, ?:\Windows\System32\taskhost*.exe, ?:\Windows\SysWOW64\dllhost.exe, ?:\Windows\SysWOW64\taskhost*.exeexcludes:process.executable
process.parent.executableeq?:\Windows\System32\svchost.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\svchost.exe"
process.nameeqcscript.exe, wscript.exeexcludes:process.name field:"process.name" value:"cscript.exe" field:"process.name" value:"wscript.exe"
process.parent.executableeq?:\Program Files\Microsoft Monitoring Agent\Agent\MonitoringHost.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\Microsoft Monitoring Agent\Agent\MonitoringHost.exe"
process.executableeq?:\Windows\AdminArsenal\PDQInventory-Scanner\service-1\exec\PDQInventoryScanner.exe, ?:\Windows\System32\wbem\WmiPrvSE.exe, ?:\Windows\System32\inetsrv\w3wp.exe, ?:\Windows\SysWOW64\inetsrv\w3wp.exe, ?:\Windows\System32\wsmprovhost.exe, ?:\Windows\System32\Essentials\SharedServiceHost.exe, ?:\Windows\System32\Essentials\RunTask.exe, ?:\Windows\System32\Essentials\ProviderRegistryService.exe, ?:\Windows\System32\mmc.exe, ?:\Windows\SysWOW64\mmc.exe, ?:\Windows\System32\ServerManager.exe, ?:\Windows\System32\dsac.exe, ?:\Windows\System32\Vmw.exe, ?:\Windows\SysWOW64\msiexec.exe, ?:\Windows\System32\msiexec.exe, ?:\Windows\System32\ClusterUpdateUI.exe, ?:\Windows\System32\Essentials\Dashboard.exe, ?:\Windows\System32\gpresult.exe, ?:\Windows\System32\RAMgmtUI.exe, ?:\Windows\System32\LogonUI.exe, ?:\Windows\System32\consent.exe, ?:\Windows\System32\conhost.exeexcludes:process.executable
process.nameeqpowershell.exe, powershell_ise.exe, pwsh.exeexcludes:process.name field:"process.name" value:"powershell.exe" field:"process.name" value:"powershell_ise.exe" field:"process.name" value:"pwsh.exe"
destination.addresswildcard127.*, ::1excludes:destination.address field:"destination.address" value:"127.*" field:"destination.address" value:"::1"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.porteq
  • 389 transforms: number
field:"DestinationPort" kind:eq value:"389"
dll.namewildcard
  • System.DirectoryServices*.dll corpus 2 (elastic 2)
field:"dll.name" kind:wildcard value:"System.DirectoryServices*.dll"
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
network.directioneq
  • egress corpus 17 (elastic 17)
field:"Initiated" kind:eq value:"egress"
network.transporteq
  • tcp corpus 26 (elastic 25, sigma 1)
field:"Protocol" kind:eq value:"tcp"
process.code_signature.subject_namewildcard
  • Microsoft * corpus 10 (elastic 10)
field:"Signature" kind:wildcard value:"Microsoft *"
process.executablewildcard
  • ?:\Windows\SysWOW64\* corpus 6 (elastic 6)
  • ?:\Windows\system32\* corpus 6 (elastic 6)
field:"Image" kind:wildcard
process.parent.nameis_not_null
  • (no value, null check)
field:"parent_process_name" kind:is_not_null
source.portge
  • 49152 transforms: number corpus 16 (elastic 16)
field:"SourcePort" kind:ge value:"49152"