Detection: Short Lived Windows Accounts

Description

The following analytic detects the rapid creation and deletion of Windows accounts within a short time frame of 1 hour. It leverages the "Change" data model in Splunk, specifically monitoring events with result IDs 4720 (account creation) and 4726 (account deletion). This behavior is significant as it may indicate an attacker attempting to create and remove accounts quickly to evade detection or gain unauthorized access. If confirmed malicious, this activity could lead to unauthorized access, privilege escalation, or further malicious actions within the environment. Immediate investigation of flagged events is crucial to mitigate potential damage.

 1
 2| tstats `security_content_summariesonly` values(All_Changes.result_id) as result_id count min(_time) as firstTime max(_time) as lastTime from datamodel=Change where All_Changes.result_id=4720 OR All_Changes.result_id=4726 by _time span=1h All_Changes.user All_Changes.dest All_Changes.Account_Management.src All_Changes.Account_Management.src_user 
 3| `security_content_ctime(lastTime)` 
 4| `security_content_ctime(firstTime)` 
 5| `drop_dm_object_name("All_Changes")` 
 6| `drop_dm_object_name("Account_Management")` 
 7| transaction user connected=false maxspan=60m 
 8| eval create_result_id=mvindex(result_id, 0) 
 9| eval delete_result_id=mvindex(result_id, 1) 
10| search create_result_id = 4720 delete_result_id=4726 
11| table firstTime lastTime count user src src_user dest create_result_id delete_result_id 
12| `short_lived_windows_accounts_filter`

Data Source

Name Platform Sourcetype Source
Windows Event Log System 4720 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:System'
Windows Event Log System 4726 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:System'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
short_lived_windows_accounts_filter search *
short_lived_windows_accounts_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1136.001 Local Account Persistence
T1136 Create Account Persistence
T1078.003 Local Accounts Defense Evasion
KillChainPhase.DELIVERY
KillChainPhase.EXPLOITAITON
KillChainPhase.INSTALLATION
NistCategory.DE_CM
Cis18Value.CIS_10
APT3
APT39
APT41
APT5
Daggerfly
Dragonfly
FIN13
Fox Kitten
Indrik Spider
Kimsuky
Leafminer
Magic Hound
TeamTNT
Wizard Spider
Indrik Spider
Scattered Spider
APT29
APT32
FIN10
FIN7
HAFNIUM
Kimsuky
PROMETHIUM
Play
Tropic Trooper
Turla

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Notable Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Risk Event True
This configuration file applies to all detections of type TTP. These detections will use Risk Based Alerting and generate Notable Events.

Implementation

This search requires you to have enabled your Group Management Audit Logs in your Local Windows Security Policy and be ingesting those logs. More information on how to enable them can be found here: http://whatevernetworks.com/auditing-group-membership-changes-in-active-directory/. We also recommend adjsuting the maxspan and _time parameter to better fit your environment.

Known False Positives

It is possible that an administrator created and deleted an account in a short time period. Verifying activity with an administrator is advised.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
A user account $user$ is created and deleted within a short time period on host $dest$ by user $src_user$ 63 70 90
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset WinEventLog:Security WinEventLog
Integration ✅ Passing Dataset WinEventLog:Security WinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub | Version: 6