Detection rules › Elastic
Unusual LDAP Client Process
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
| Tactic | Techniques |
|---|---|
| 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.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | /Processid:{7F9BBC82-BA5F-4448-8622-EF76B8D007E6} | excludes:process.args field:"process.args" value:"/Processid:{7F9BBC82-BA5F-4448-8622-EF76B8D007E6}" |
process.name | eq | dllhost.exe | excludes:process.name field:"process.name" value:"dllhost.exe" |
process.args | eq | gpsvc | excludes:process.args field:"process.args" value:"gpsvc" |
process.executable | eq | ?:\Windows\system32\svchost.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\system32\svchost.exe" |
process.parent.name | eq | services.exe | excludes:process.parent.name field:"process.parent.name" value:"services.exe" |
process.code_signature.subject_name | eq | PDQ.com Corporation, ci solution GmbH | excludes: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.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.command_line | match | zzzzInvokeManagedCustomActionOutOfProc | excludes:process.command_line field:"process.command_line" value:"zzzzInvokeManagedCustomActionOutOfProc" |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.parent.name | eq | msiexec.exe | excludes:process.parent.name field:"process.parent.name" value:"msiexec.exe" |
process.executable | wildcard | ?:\Windows\System32\dllhost.exe, ?:\Windows\System32\taskhost*.exe, ?:\Windows\SysWOW64\dllhost.exe, ?:\Windows\SysWOW64\taskhost*.exe | excludes:process.executable |
process.parent.executable | eq | ?:\Windows\System32\svchost.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\svchost.exe" |
process.name | eq | cscript.exe, wscript.exe | excludes:process.name field:"process.name" value:"cscript.exe" field:"process.name" value:"wscript.exe" |
process.parent.executable | eq | ?:\Program Files\Microsoft Monitoring Agent\Agent\MonitoringHost.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\Microsoft Monitoring Agent\Agent\MonitoringHost.exe" |
process.executable | eq | ?:\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 | excludes:process.executable |
process.name | eq | powershell.exe, powershell_ise.exe, pwsh.exe | excludes:process.name field:"process.name" value:"powershell.exe" field:"process.name" value:"powershell_ise.exe" field:"process.name" value:"pwsh.exe" |
destination.address | wildcard | 127.*, ::1 | excludes:destination.address field:"destination.address" value:"127.*" field:"destination.address" value:"::1" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.port | eq |
| field:"DestinationPort" kind:eq value:"389" |
dll.name | wildcard |
| field:"dll.name" kind:wildcard value:"System.DirectoryServices*.dll" |
event.action | eq |
| field:"EventType" kind:eq value:"start" |
network.direction | eq |
| field:"Initiated" kind:eq value:"egress" |
network.transport | eq |
| field:"Protocol" kind:eq value:"tcp" |
process.code_signature.subject_name | wildcard |
| field:"Signature" kind:wildcard value:"Microsoft *" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.name | is_not_null | field:"parent_process_name" kind:is_not_null | |
source.port | ge |
| field:"SourcePort" kind:ge value:"49152" |