Suspicious Startup Shell Folder Modification
Identifies suspicious startup shell folder modifications to change the default Startup directory in order to bypass detections monitoring file creation in the Windows Startup folder.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2021/03/15"
3integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
4maturity = "production"
5updated_date = "2024/10/15"
6min_stack_version = "8.14.0"
7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
8
9[transform]
10[[transform.osquery]]
11label = "Osquery - Retrieve DNS Cache"
12query = "SELECT * FROM dns_cache"
13
14[[transform.osquery]]
15label = "Osquery - Retrieve All Services"
16query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
17
18[[transform.osquery]]
19label = "Osquery - Retrieve Services Running on User Accounts"
20query = """
21SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
22NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
23user_account == null)
24"""
25
26[[transform.osquery]]
27label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
28query = """
29SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
30services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
31authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
32"""
33
34
35[rule]
36author = ["Elastic"]
37description = """
38Identifies suspicious startup shell folder modifications to change the default Startup directory in order to bypass
39detections monitoring file creation in the Windows Startup folder.
40"""
41from = "now-9m"
42index = ["logs-endpoint.events.registry-*", "endgame-*", "logs-windows.sysmon_operational-*", "winlogbeat-*", "logs-m365_defender.event-*", "logs-sentinel_one_cloud_funnel.*"]
43language = "eql"
44license = "Elastic License v2"
45name = "Suspicious Startup Shell Folder Modification"
46note = """## Triage and analysis
47
48### Investigating Suspicious Startup Shell Folder Modification
49
50Techniques used within malware and by adversaries often leverage the Windows registry to store malicious programs for persistence. Startup shell folders are often targeted as they are not as prevalent as normal Startup folder paths so this behavior may evade existing AV/EDR solutions. These programs may also run with higher privileges which can be ideal for an attacker.
51
52> **Note**:
53> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/master/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
54
55#### Possible investigation steps
56
57- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
58- Review the source process and related file tied to the Windows Registry entry.
59- Validate if the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
60- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
61- Examine the host for derived artifacts that indicate suspicious activities:
62 - Analyze the file using a private sandboxed analysis system.
63 - Observe and collect information about the following activities in both the sandbox and the alert subject host:
64 - Attempts to contact external domains and addresses.
65 - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
66 - Examine the DNS cache for suspicious or anomalous entries.
67 - $osquery_0
68 - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
69 - Examine the host services for suspicious or anomalous entries.
70 - $osquery_1
71 - $osquery_2
72 - $osquery_3
73 - Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
74- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
75
76### False positive analysis
77
78- There is a high possibility of benign legitimate programs being added to shell folders. This activity could be based on new software installations, patches, or other network administrator activity. Before undertaking further investigation, it should be verified that this activity is not benign.
79
80### Related rules
81
82- Startup or Run Key Registry Modification - 97fc44d3-8dae-4019-ae83-298c3015600f
83- Persistent Scripts in the Startup Directory - f7c4dc5a-a58d-491d-9f14-9b66507121c0
84
85### Response and remediation
86
87- Initiate the incident response process based on the outcome of the triage.
88- Isolate the involved host to prevent further post-compromise behavior.
89- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
90- If the malicious file was delivered via phishing:
91 - Block the email sender from sending future emails.
92 - Block the malicious web pages.
93 - Remove emails from the sender from mailboxes.
94 - Consider improvements to the security awareness program.
95- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
96- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
97"""
98references = [
99 "https://www.elastic.co/security-labs/elastic-security-uncovers-blister-malware-campaign",
100 "https://www.elastic.co/security-labs/revisiting-blister-new-developments-of-the-blister-loader",
101]
102risk_score = 73
103rule_id = "c8b150f0-0164-475b-a75e-74b47800a9ff"
104severity = "high"
105tags = [
106 "Domain: Endpoint",
107 "OS: Windows",
108 "Use Case: Threat Detection",
109 "Tactic: Persistence",
110 "Tactic: Defense Evasion",
111 "Resources: Investigation Guide",
112 "Data Source: Elastic Endgame",
113 "Data Source: Elastic Defend",
114 "Data Source: Sysmon",
115 "Data Source: Microsoft Defender for Endpoint",
116 "Data Source: SentinelOne",
117]
118timestamp_override = "event.ingested"
119type = "eql"
120
121query = '''
122registry where host.os.type == "windows" and event.type == "change" and
123 registry.value : ("Common Startup", "Startup") and
124 registry.path : (
125 "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Common Startup",
126 "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Common Startup",
127 "HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Startup",
128 "HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Startup",
129 "HKU\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Startup",
130 "HKU\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Startup",
131 "HKCU\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Startup",
132 "HKCU\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Startup",
133 "\\REGISTRY\\MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Common Startup",
134 "\\REGISTRY\\MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Common Startup",
135 "\\REGISTRY\\USER\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Startup",
136 "\\REGISTRY\\USER\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Startup",
137 "MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Common Startup",
138 "MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Common Startup",
139 "USER\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\Startup",
140 "USER\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Startup"
141 ) and
142 registry.data.strings != null and
143 /* Normal Startup Folder Paths */
144 not registry.data.strings : (
145 "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup",
146 "%ProgramData%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup",
147 "%USERPROFILE%\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup",
148 "C:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup"
149 )
150'''
151
152
153[[rule.threat]]
154framework = "MITRE ATT&CK"
155[[rule.threat.technique]]
156id = "T1547"
157name = "Boot or Logon Autostart Execution"
158reference = "https://attack.mitre.org/techniques/T1547/"
159[[rule.threat.technique.subtechnique]]
160id = "T1547.001"
161name = "Registry Run Keys / Startup Folder"
162reference = "https://attack.mitre.org/techniques/T1547/001/"
163
164
165
166[rule.threat.tactic]
167id = "TA0003"
168name = "Persistence"
169reference = "https://attack.mitre.org/tactics/TA0003/"
170[[rule.threat]]
171framework = "MITRE ATT&CK"
172[[rule.threat.technique]]
173id = "T1112"
174name = "Modify Registry"
175reference = "https://attack.mitre.org/techniques/T1112/"
176
177
178[rule.threat.tactic]
179id = "TA0005"
180name = "Defense Evasion"
181reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Investigating Suspicious Startup Shell Folder Modification
Techniques used within malware and by adversaries often leverage the Windows registry to store malicious programs for persistence. Startup shell folders are often targeted as they are not as prevalent as normal Startup folder paths so this behavior may evade existing AV/EDR solutions. These programs may also run with higher privileges which can be ideal for an attacker.
Note: This investigation guide uses the Osquery Markdown Plugin introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
Possible investigation steps
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Review the source process and related file tied to the Windows Registry entry.
- Validate if the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
- Examine the host for derived artifacts that indicate suspicious activities:
- Analyze the file using a private sandboxed analysis system.
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process'
process.entity_id
. - Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process'
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
- Attempts to contact external domains and addresses.
- Retrieve the files' SHA-256 hash values using the PowerShell
Get-FileHash
cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
False positive analysis
- There is a high possibility of benign legitimate programs being added to shell folders. This activity could be based on new software installations, patches, or other network administrator activity. Before undertaking further investigation, it should be verified that this activity is not benign.
Related rules
- Startup or Run Key Registry Modification - 97fc44d3-8dae-4019-ae83-298c3015600f
- Persistent Scripts in the Startup Directory - f7c4dc5a-a58d-491d-9f14-9b66507121c0
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- If the malicious file was delivered via phishing:
- Block the email sender from sending future emails.
- Block the malicious web pages.
- Remove emails from the sender from mailboxes.
- Consider improvements to the security awareness program.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
References
Related rules
- Registry Persistence via AppInit DLL
- Adobe Hijack Persistence
- Code Signing Policy Modification Through Registry
- Conhost Spawned By Suspicious Parent Process
- Creation of a Hidden Local User Account