Detection rule
PUA - Suspicious ActiveDirectory Enumeration Via AdFind.EXE
Overview
Detects active directory enumeration activity using known AdFind CLI flags
- Rule id
455b9d50-15a1-4b99-853f-8d37655a4c1b- ATT&CK techniques
- T1087.002 Account Discovery: Domain Account
- Severity
- High
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- The Gentlemen, INC Ransom, Akira, safepay, Play
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
1 of 1 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · 455b9d50-15a1-4b99-853f-8d37655a4c1b
title: PUA - Suspicious ActiveDirectory Enumeration Via AdFind.EXE
id: 455b9d50-15a1-4b99-853f-8d37655a4c1b
related:
- id: 9a132afa-654e-11eb-ae93-0242ac130002
type: similar
- id: 514e7e3e-b3b4-4a67-af60-be20f139198b
type: similar
status: test
description: Detects active directory enumeration activity using known AdFind CLI flags
references:
- https://www.joeware.net/freetools/tools/adfind/
- https://social.technet.microsoft.com/wiki/contents/articles/7535.adfind-command-examples.aspx
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1087.002/T1087.002.md
author: frack113
date: 2021-12-13
modified: 2023-03-05
tags:
- attack.discovery
- attack.t1087.002
logsource:
product: windows
category: process_creation
detection:
selection_password: # Listing password policy
CommandLine|contains:
- lockoutduration
- lockoutthreshold
- lockoutobservationwindow
- maxpwdage
- minpwdage
- minpwdlength
- pwdhistorylength
- pwdproperties
selection_enum_ad: # Enumerate Active Directory Admins
CommandLine|contains: '-sc admincountdmp'
selection_enum_exchange: # Enumerate Active Directory Exchange AD Objects
CommandLine|contains: '-sc exchaddresses'
condition: 1 of selection_*
falsepositives:
- Authorized administrative activity
level: high
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_pua_adfind_enumeration/info.ymlQRadar AQL
IBM QRadar AQL (hunting query)Hunting query
Hunting search for the Log Activity tab or the API. It is not a QRadar rule.
AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).
SELECT * FROM events WHERE devicetype=12 AND ((LOWER(Command) LIKE '%lockoutduration%' OR LOWER(Command) LIKE '%lockoutthreshold%' OR LOWER(Command) LIKE '%lockoutobservationwindow%' OR LOWER(Command) LIKE '%maxpwdage%' OR LOWER(Command) LIKE '%minpwdage%' OR LOWER(Command) LIKE '%minpwdlength%' OR LOWER(Command) LIKE '%pwdhistorylength%' OR LOWER(Command) LIKE '%pwdproperties%') OR LOWER(Command) LIKE '%-sc admincountdmp%' OR LOWER(Command) LIKE '%-sc exchaddresses%')QRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: PUA - Suspicious ActiveDirectory Enumeration Via AdFind.EXE- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
Building blocks
BB:OffSet7:PUA Suspicious ActiveDirectory Enumeration Via A:selection_password(match)All test lines must match (AND).Commandcontains:lockoutduration,lockoutthreshold,lockoutobservationwindow,maxpwdage,minpwdage,minpwdlength,pwdhistorylength,pwdproperties
BB:OffSet7:PUA Suspicious ActiveDirectory Enumeration Via A:selection_enum_ad(match)All test lines must match (AND).Commandcontains:-sc admincountdmp
BB:OffSet7:PUA Suspicious ActiveDirectory Enumeration Via A:selection_enum_exchange(match)All test lines must match (AND).Commandcontains:-sc exchaddresses
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1 - when an event matches the condition built from these building blocks:
(ANY of [BB:OffSet7:PUA Suspicious ActiveDirectory Enumeration Via A:selection_password, BB:OffSet7:PUA Suspicious ActiveDirectory Enumeration Via A:selection_enum_ad, BB:OffSet7:PUA Suspicious ActiveDirectory Enumeration Via A:selection_enum_exchange])
Main rule, option B (AQL filter test)
- when the event matches this AQL filter query:
devicetype=12 AND ((LOWER(Command) LIKE '%lockoutduration%' OR LOWER(Command) LIKE '%lockoutthreshold%' OR LOWER(Command) LIKE '%lockoutobservationwindow%' OR LOWER(Command) LIKE '%maxpwdage%' OR LOWER(Command) LIKE '%minpwdage%' OR LOWER(Command) LIKE '%minpwdlength%' OR LOWER(Command) LIKE '%pwdhistorylength%' OR LOWER(Command) LIKE '%pwdproperties%') OR LOWER(Command) LIKE '%-sc admincountdmp%' OR LOWER(Command) LIKE '%-sc exchaddresses%')
Rule response
- Severity 7, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
CommandLine IN ("*lockoutduration*", "*lockoutthreshold*", "*lockoutobservationwindow*", "*maxpwdage*", "*minpwdage*", "*minpwdlength*", "*pwdhistorylength*", "*pwdproperties*") OR CommandLine="*-sc admincountdmp*" OR CommandLine="*-sc exchaddresses*"Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[PUA - Suspicious ActiveDirectory Enumeration Via AdFind.EXE]
description = Detects active directory enumeration activity using known AdFind CLI flags
search = CommandLine IN ("*lockoutduration*", "*lockoutthreshold*", "*lockoutobservationwindow*", "*maxpwdage*", "*minpwdage*", "*minpwdlength*", "*pwdhistorylength*", "*pwdproperties*") OR CommandLine="*-sc admincountdmp*" OR CommandLine="*-sc exchaddresses*"Microsoft Sentinel
Microsoft Sentinel KQL (ASIM)Hunting query
Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.
imProcessCreate
| where (TargetProcessCommandLine contains "lockoutduration" or TargetProcessCommandLine contains "lockoutthreshold" or TargetProcessCommandLine contains "lockoutobservationwindow" or TargetProcessCommandLine contains "maxpwdage" or TargetProcessCommandLine contains "minpwdage" or TargetProcessCommandLine contains "minpwdlength" or TargetProcessCommandLine contains "pwdhistorylength" or TargetProcessCommandLine contains "pwdproperties") or TargetProcessCommandLine contains "-sc admincountdmp" or TargetProcessCommandLine contains "-sc exchaddresses"Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceProcessEvents
| where (ProcessCommandLine contains "lockoutduration" or ProcessCommandLine contains "lockoutthreshold" or ProcessCommandLine contains "lockoutobservationwindow" or ProcessCommandLine contains "maxpwdage" or ProcessCommandLine contains "minpwdage" or ProcessCommandLine contains "minpwdlength" or ProcessCommandLine contains "pwdhistorylength" or ProcessCommandLine contains "pwdproperties") or ProcessCommandLine contains "-sc admincountdmp" or ProcessCommandLine contains "-sc exchaddresses"Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
(process.command_line:(*lockoutduration* OR *lockoutthreshold* OR *lockoutobservationwindow* OR *maxpwdage* OR *minpwdage* OR *minpwdlength* OR *pwdhistorylength* OR *pwdproperties*)) OR process.command_line:*\-sc\ admincountdmp* OR process.command_line:*\-sc\ exchaddresses*Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where (process.command_line like~ ("*lockoutduration*", "*lockoutthreshold*", "*lockoutobservationwindow*", "*maxpwdage*", "*minpwdage*", "*minpwdlength*", "*pwdhistorylength*", "*pwdproperties*")) or process.command_line:"*-sc admincountdmp*" or process.command_line:"*-sc exchaddresses*"Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where process.command_line like "*lockoutduration*" or process.command_line like "*lockoutthreshold*" or process.command_line like "*lockoutobservationwindow*" or process.command_line like "*maxpwdage*" or process.command_line like "*minpwdage*" or process.command_line like "*minpwdlength*" or process.command_line like "*pwdhistorylength*" or process.command_line like "*pwdproperties*" or process.command_line like "*-sc admincountdmp*" or process.command_line like "*-sc exchaddresses*"Required telemetry
- Log source
product: windows · category: process_creation- Fields used
CommandLine
False positives
- Authorized administrative activity
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
Author and attribution
- Author
- frack113
- Source
- SigmaHQ ·
rules/windows/process_creation/proc_creation_win_pua_adfind_enumeration.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2