Query Details

Adfind Detection

Query

# Rule : Detection of ADFind Command Usage

## Description
This detection rule identifies suspicious use of `ADFind`, a command-line Active Directory query tool commonly leveraged by attackers for reconnaissance. Adversaries may use ADFind to extract valuable Active Directory data, such as domain information, user and group lists, or trust relationships. Monitoring for specific patterns in process command lines can help detect unauthorized ADFind activities and provide early warning of potential lateral movement or privilege escalation attempts.

This rule monitors for the execution of ADFind commands, especially those containing sensitive keywords such as `"objectcategory"`, `"domainlist"`, `"adinfo"`, `"trustdmp"`, and others that indicate potential misuse for domain enumeration or privilege escalation.

- [Elastic Security: AdFind Command Activity](https://www.elastic.co/guide/en/security/current/adfind-command-activity.html)

## Detection Logic
- Monitors `DeviceProcessEvents` for events where:
  - The `ProcessCommandLine` contains keywords related to ADFind command usage.
  - The `ProcessCommandLine` matches a regular expression pattern indicating piping or redirection, which may suggest an attempt to manipulate or exfiltrate the gathered data.

## Tags
- Active Directory Reconnaissance
- ADFind
- Domain Enumeration
- Lateral Movement
- Suspicious Command-Line Activity
- Threat Detection

## Search Query
```kql
let commandline = dynamic(["objectcategory","domainlist","dcmodes","adinfo","trustdmp","computers_pwdnotreqd","Domain Admins", "objectcategory=*"]);
DeviceProcessEvents
| where ProcessCommandLine  has_any (commandline)
| where ProcessCommandLine matches regex "(.*)>(.*)"
```

Explanation

This query is designed to detect the use of the ADFind command-line tool, which is often used by attackers to gather information from Active Directory for reconnaissance purposes. The query looks for specific keywords in the command line that are commonly associated with ADFind usage, such as "objectcategory", "domainlist", "adinfo", and "trustdmp". It also checks for patterns that indicate the output of these commands might be redirected or piped, which could suggest an attempt to manipulate or exfiltrate the data.

In simple terms, this query helps identify when someone is using ADFind to potentially gather sensitive Active Directory information, which could be an early sign of malicious activity like lateral movement or privilege escalation.

Details

Ali Hussein profile picture

Ali Hussein

Released: August 26, 2024

Tables

DeviceProcessEvents

Keywords

ActiveDirectoryReconnaissanceADFindDomainEnumerationLateralMovementSuspiciousCommandLineActivityThreatDetectionDeviceProcessEvents

Operators

letdynamichas_anymatchesregex

Actions