Query Details

Rule : Potential Kerberoasting and DCSync Command Patterns

Credential Access Kerberoast DC Sync Commands

Query

DeviceProcessEvents
| where Timestamp > ago(7d)
| where ProcessCommandLine has_any ("GetUserSPNs", "Invoke-Kerberoast", "Rubeus", "lsadump::dcsync", "secretsdump", "Get-ADReplAccount", "DCSync", "krbtgt")
| extend Signal=case(ProcessCommandLine has_any ("lsadump::dcsync","secretsdump","Get-ADReplAccount","DCSync"),"DCSync-related command", ProcessCommandLine has_any ("GetUserSPNs","Invoke-Kerberoast","Rubeus"),"Kerberoasting-related command","Credential access keyword")
| project Timestamp, DeviceId, DeviceName, AccountName, FileName, ProcessCommandLine, Signal, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by Timestamp desc

About this query

Explanation

This query is designed to detect potentially malicious activities related to Kerberoasting and DCSync attacks, which are techniques used to access credentials in Active Directory environments. Here's a simplified breakdown of the query and its purpose:

  1. Purpose: The query aims to identify command lines that reference well-known tools used for Kerberoasting and DCSync attacks. These tools are often used by attackers to gain unauthorized access to credentials.

  2. Data Source: It searches through the DeviceProcessEvents table, which logs events related to processes running on devices.

  3. Keywords: The query looks for specific keywords in the ProcessCommandLine field, such as "GetUserSPNs", "Invoke-Kerberoast", "Rubeus", "lsadump::dcsync", "secretsdump", "Get-ADReplAccount", "DCSync", and "krbtgt". These keywords are associated with tools and commands used in Kerberoasting and DCSync attacks.

  4. Classification: Each detected command is labeled as either a "DCSync-related command", "Kerberoasting-related command", or "Credential access keyword" based on the presence of specific keywords.

  5. Output: The query projects relevant information such as the timestamp, device ID, device name, account name, file name, command line, and initiating process details. The results are ordered by the most recent events.

  6. False Positives: The query includes guidance on tuning to reduce false positives, such as excluding known authorized red-team activities and reviewing legitimate uses of certain keywords.

  7. Triage Steps: If suspicious activity is detected, the query suggests steps for further investigation, such as identifying targeted accounts and checking for related alerts. It also recommends rotating passwords for affected accounts if an attack is confirmed.

  8. Note: The query is intended for hunting potential threats and should be used as a starting point for further investigation rather than an immediate alerting mechanism.