Elastic medium stable kql
Rare Connection to WebDAV Target
Identifies rare connection attempts to a Web Distributed Authoring and Versioning (WebDAV) resource. Attackers may inject WebDAV paths in files or features opened by a victim user to leak their NTLM credentials via forced authentication.
Detection Logic
from logs-endpoint.events.process-*, logs-windows.sysmon_operational-*, logs-system.security-*, logs-windows.*, winlogbeat-*, logs-crowdstrike.fdr*, logs-m365_defender.event-* METADATA _id, _version, _index
| where
event.category == "process" and
event.type == "start" and
process.name == "rundll32.exe" and
process.command_line like "*DavSetCookie*"
| keep host.id, process.command_line, user.name, user.id
// extract the host from the WebDAV URL authority, excluding optional credentials and port
| grok process.command_line """(?i:https?)://(?:[^/@\s]+@)?(?<Esql.server_webdav_server>[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*)"""
| eval Esql.server_webdav_server = TO_LOWER(Esql.server_webdav_server)
| where
Esql.server_webdav_server is not null and
not Esql.server_webdav_server in ("www.google.com", "www.elastic.co", "google.com", "github.com", "www.github.com", "sharepoint.com", "live.net") and
not Esql.server_webdav_server like ("*.live.net", "*.sharepoint.com") and
// excludes private IP ranges
not Esql.server_webdav_server rlike """(10\.(\d{1,3}\.){2}\d{1,3}
| 172\.(1[6-9]
| 2\d
| 3[0-1])\.(\d{1,3}\.)\d{1,3}
| 192\.168\.(\d{1,3}\.)\d{1,3})"""
| stats
Esql.event_count = count(*),
Esql.host_id_count_distinct = count_distinct(host.id),
Esql.host_id_values = values(host.id),
Esql.user_name_values = values(user.name)
by Esql.server_webdav_server
| where
Esql.host_id_count_distinct == 1 and Esql.event_count <= 3
| eval host.id = MV_MIN(Esql.host_id_values), user.name = MV_MIN(Esql.user_name_values), destination.domain = MV_MIN(Esql.server_webdav_server)
| KEEP host.id, user.name, destination.domain, Esql.* Field Validations
Loading…
Comments (0)
Loading comments...