Windows DLL Search Order Hijacking Hunt with Sysmon
Description
This hunting analytic identifies known Windows libraries potentially used in DLL search order hijacking or DLL Sideloading scenarios. Such cases may necessitate recompiling the DLL, relocating the DLL, or moving the vulnerable process. The query searches for any processes running outside of system32 or syswow64 directories. Certain libraries inherently operate from different application paths and must be added to the exclusion list as required. The lookup includes Microsoft native libraries cataloged in the Hijacklibs.net project.
- Type: Hunting
-
Product: Splunk Enterprise, Splunk Enterprise Security, Splunk Cloud
- Last Updated: 2024-03-17
- Author: Michael Haag, Splunk
- ID: 79c7d1fc-64c7-91be-a616-ccda752efe81
Annotations
ATT&CK
Kill Chain Phase
- Installation
- Exploitation
NIST
- DE.AE
CIS20
- CIS 10
CVE
Search
1
2
3
4
5
`sysmon` EventCode=7 NOT (process_path IN ("*\\system32\\*", "*\\syswow64\\*","*\\winsxs\\*","*\\wbem\\*"))
| lookup hijacklibs library AS loaded_file OUTPUT islibrary
| search islibrary = True
| stats count min(_time) as firstTime max(_time) as lastTime values(process_name) as process_name by _time dest loaded_file
| `windows_dll_search_order_hijacking_hunt_with_sysmon_filter`
Macros
The SPL above uses the following Macros:
windows_dll_search_order_hijacking_hunt_with_sysmon_filter is a empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Lookups
The SPL above uses the following Lookups:
- hijacklibs with data
Required fields
List of fields required to use this analytic.
- _time
- dest
- ImageLoaded
- Module_Path
How To Implement
The search is written against the latest Sysmon TA 4.0 https://splunkbase.splunk.com/app/5709. For this specific event ID 7, the sysmon TA will extract the ImageLoaded name to the loaded_file field which is used in the search to compare against the hijacklibs lookup.
Known False Positives
False positives will be present based on paths. Filter or add other paths to the exclusion as needed. Some applications may legitimately load libraries from non-standard paths.
Associated Analytic Story
RBA
Risk Score | Impact | Confidence | Message |
---|---|---|---|
1.0 | 10 | 10 | Potential Windows DLL Search Order Hijacking detected on $dest$ |
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.
Reference
Test Dataset
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 | version: 4