Detection: Windows Short Lived DNS Record

Description

The following analytic identifies the creation and quick deletion of a DNS object within 300 seconds in an Active Directory environment, indicative of a potential attack abusing DNS. This detection leverages Windows Security Event Codes 5136 and 5137, analyzing the duration between these events. This activity is significant as temporary DNS entries allows attackers to cause unexpecting network trafficking, leading to potential compromise.

1`wineventlog_security` ((EventCode=5137  ObjectClass="dnsNode") OR (EventCode=5136 ObjectClass="dnsNode" AttributeLDAPDisplayName="dNSTombstoned" AttributeValue="TRUE")) 
2| stats min(_time) as firstTime max(_time) as lastTime values(EventCode) as event_codes values(ObjectDN) as dns_record values(SubjectUserName) as user values(Computer) as dest by ObjectGUID 
3| where mvcount(event_codes)=2 
4| eval time_diff=lastTime - firstTime 
5| where time_diff <= 300 
6| table firstTime, lastTime, dns_record, user, dest, time_diff, ObjectGUID 
7| `security_content_ctime(firstTime)` 
8| `security_content_ctime(lastTime)` 
9| `windows_short_lived_dns_record_filter`

Data Source

Name Platform Sourcetype Source
Windows Event Log Security 5136 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Security'
Windows Event Log Security 5137 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Security'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_short_lived_dns_record_filter search *
windows_short_lived_dns_record_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
T1071.004 DNS Command And Control
T1557.001 LLMNR/NBT-NS Poisoning and SMB Relay Collection
T1187 Forced Authentication Credential Access
Command and Control
Exploitation
DE.CM
CIS 10

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

To successfully implement this search, you ned to be ingesting Event codes 5136 and 5137. The Advanced Security Audit policy setting Audit Directory Services Changes within DS Access needs to be enabled. For these event codes to be generated, specific SACLs are required.

Known False Positives

Creating and deleting a DNS server object within 30 seconds or less is unusual but not impossible in a production environment. Filter as needed.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

A short-lived DNS object was created and deleted on $dest$

Risk Object Risk Object Type Risk Score Threat Objects
dest system 64 No Threat Objects
user user 64 No Threat Objects

References

Detection Testing

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

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: 1