| ID | Technique | Tactic |
|---|---|---|
| T1218.011 | Rundll32 | Defense Evasion |
Detection: Windows Rundll32 with Non-Standard File Extension
Description
This analytic identifies the instance of rundll32.exe process loading a non-standard Windows modules file extension. This behavior is not common and can be associated with malicious activities, such as the Gh0st RAT backdoor. This technique is to evade possible detection by security tools that monitors a suspicious dll loading activity.
Search
1
2| tstats `security_content_summariesonly`
3 count min(_time) as firstTime
4 max(_time) as lastTime
5
6FROM datamodel=Endpoint.Processes WHERE
7
8`process_rundll32`
9(
10 Processes.parent_process_path IN (
11 "*:\\PerfLogs\\*",
12 "*:\\ProgramData\\*",
13 "*:\\Recycle.bin\\*",
14 "*:\\Users\\Administrator\\Music\\*",
15 "*:\\Users\\Public\\*",
16 "*:\\Windows\\Cursors\\*",
17 "*:\\Windows\\debug\\*",
18 "*:\\Windows\\fonts\\*",
19 "*:\\Windows\\INF\\*",
20 "*:\\Windows\\Media\\*",
21 "*:\\Windows\\Prefetch\\*",
22 "*:\\Windows\\repair\\*",
23 "*:\\Windows\\Tasks\\*",
24 "*\\Temp\\*"
25 )
26 OR
27 Processes.parent_process_name IN (
28 "*cmd.exe*",
29 "*cscript.exe*",
30 "*mshta.exe*",
31 "*powershell.exe*",
32 "*pwsh.exe*",
33 "*regsvr32.exe*",
34 "*wscript.exe*"
35 )
36)
37NOT Processes.process IN (
38 "*.cpl*",
39 "*.dll*",
40 "*.drv*",
41 "*.inf*",
42 "*.mui*",
43 "*.ocx*"
44 )
45
46BY Processes.action Processes.dest Processes.original_file_name
47 Processes.parent_process_exec Processes.parent_process_guid
48 Processes.parent_process_id Processes.parent_process_path
49 Processes.process_exec Processes.process_guid Processes.process_hash
50 Processes.process_id Processes.process_integrity_level
51 Processes.process_path Processes.user Processes.user_id
52 Processes.vendor_product Processes.parent_process_name
53 Processes.parent_process Processes.process_name Processes.process
54
55
56| `drop_dm_object_name(Processes)`
57
58
59| rex field=process "^(?<cmd_base_process>[^\s]+)\s+\"?(?<cmd_base_first_param>[^,^\"^\s]+).*?,(?<cmd_args>.*)$"
60
61
62| rex field=cmd_base_first_param "^(?<root>[^\\\\]+)\\\\(?<subdirs>[^\\\\]+)"
63
64
65| eval folder_count = mvcount(split(cmd_base_first_param, "\\"))
66
67
68| where (
69 folder_count = 3
70 AND
71 NOT lower(subdirs) IN (
72 "windows",
73 "program files",
74 "program files (x86)"
75 )
76 )
77 OR
78 like(cmd_base_first_param, "%:\\ProgramData\\%")
79 OR
80 like(cmd_base_first_param, "%:\\Users\\Public\\%")
81 OR
82 like(cmd_base_first_param, "%\\AppData\\Local\\Temp\\%")
83 OR
84 like(cmd_base_first_param, "%\\AppData\\Roaming\\%")
85
86
87| `security_content_ctime(firstTime)`
88
89| `security_content_ctime(lastTime)`
90
91| `windows_rundll32_with_non_standard_file_extension_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| CrowdStrike ProcessRollup2 | Other | 'crowdstrike:events:sensor' |
'crowdstrike' |
| Sysmon EventID 1 | 'XmlWinEventLog' |
'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' |
|
| Windows Event Log Security 4688 | 'XmlWinEventLog' |
'XmlWinEventLog:Security' |
Macros Used
| Name | Value |
|---|---|
| process_rundll32 | (Processes.process_name=rundll32.exe OR Processes.original_file_name=RUNDLL32.EXE) |
| windows_rundll32_with_non_standard_file_extension_filter | search * |
windows_rundll32_with_non_standard_file_extension_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
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 Risk Event | True |
Implementation
The detection is based on data that originates from Endpoint Detection and Response (EDR) agents. These agents are designed to provide security-related telemetry from the endpoints where the agent is installed. To implement this search, you must ingest logs that contain the process GUID, process name, and parent process. Additionally, you must ingest complete command-line executions. These logs must be processed using the appropriate Splunk Technology Add-ons that are specific to the EDR product. The logs must also be mapped to the Processes node of the Endpoint data model. Use the Splunk Common Information Model (CIM) to normalize the field names and speed up the data modeling process.
Known False Positives
Certain legitimate Windows components, third-party applications, or administrative scripts may use rundll32.exe with non-standard or extensionless inputs during normal operation. Filtering and contextual analysis are required, focus on command-line arguments, parent process, file location, and prevalence across the environment before determining malicious intent.
Associated Analytic Story
Risk Based Analytics (RBA)
Risk Message:
An instance of [$parent_process_path$] launched [$process_name$] loading a non-standard DLL extension [$process$] in host [$dest$]
| Risk Object | Risk Object Type | Risk Score | Threat Objects |
|---|---|---|---|
| dest | system | 20 | process, parent_process_name |
References
-
https://malpedia.caad.fkie.fraunhofer.de/details/win.ghost_rat
-
https://www.sentinelone.com/blog/the-curious-case-of-gh0st-malware/
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: 1