Detection: Windows Known Abused DLL Loaded Suspiciously

Description

The following analytic detects when DLLs with known abuse history are loaded from an unusual location. This activity may represent an attacker performing a DLL search order or sideload hijacking technique. These techniques are used to gain persistence as well as elevate privileges on the target system. This detection relies on Sysmon EID7 and is compatible with all Officla Sysmon TA versions.

 1`sysmon` ImageLoaded EventCode=7 NOT ImageLoaded IN ("*\\Program Files*","*\\system32\\*", "*\\syswow64\\*","*\\winsxs\\*","*\\wbem\\*") 
 2| stats latest(ProcessGuid) as process_guid, count, min(_time) as firstTime, max(_time) as lastTime by User, Computer, Image, ImageLoaded 
 3| rename User as user, Computer as dest, Image as process, ImageLoaded as loaded_file 
 4| eval process_name = case(isnotnull(process),replace(process,"(.*\\\)(?=.*(\.\w*)$
 5|(\w+)$)","")), loaded_file_path = case(isnotnull(loaded_file), replace(loaded_file, "(:[\w\. ]+)", "")), loaded_file = case(isnotnull(loaded_file),replace(loaded_file,"(.*\\\)(?=.*(\.\w*)$
 6|(\w+)$)","")), user = case(NOT user IN ("-"), replace(user, "(.*)\\\(.+)$","\2")) 
 7| lookup hijacklibs_loaded library AS loaded_file OUTPUT islibrary comment as desc 
 8| lookup hijacklibs_loaded library AS loaded_file excludes as loaded_file_path OUTPUT islibrary as excluded 
 9| search islibrary = TRUE AND excluded = false 
10| stats values(*) as * by dest, process_name, process, process_guid, loaded_file, loaded_file_path 
11| `security_content_ctime(firstTime)` 
12| `security_content_ctime(lastTime)` 
13| `windows_known_abused_dll_loaded_suspiciously_filter`

Data Source

Name Platform Sourcetype Source Supported App
Sysmon EventID 7 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' N/A

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_known_abused_dll_loaded_suspiciously_filter search *
windows_known_abused_dll_loaded_suspiciously_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
T1574.001 DLL Search Order Hijacking Defense Evasion
T1574.002 DLL Side-Loading Persistence
T1574 Hijack Execution Flow Privilege Escalation
KillChainPhase.EXPLOITAITON
KillChainPhase.INSTALLATION
NistCategory.DE_CM
Cis18Value.CIS_10
APT41
Aquatic Panda
BackdoorDiplomacy
Cinnamon Tempest
Evilnum
RTM
Threat Group-3390
Tonto Team
Whitefly
menuPass
APT19
APT3
APT32
APT41
BRONZE BUTLER
BlackTech
Chimera
Cinnamon Tempest
Earth Lusca
FIN13
GALLIUM
Higaisa
Lazarus Group
LuminousMoth
MuddyWater
Mustang Panda
Naikon
Patchwork
SideCopy
Sidewinder
Threat Group-3390
Tropic Trooper
menuPass

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

The following analytic requires Sysmon operational logs to be imported, with EID7 being mapped to the process_name field. Modify the sysmon macro as needed to match the sourcetype or add index.

Known False Positives

DLLs being loaded by user mode programs for legitimate reasons.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
The module [$loaded_file$] was loaded from an unusual location by [$process$] 10 40 25
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 XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational 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: 2