Skip to content

Commit 4a0383e

Browse files
Branch was auto-updated.
2 parents cace3d9 + f9b7d09 commit 4a0383e

5 files changed

+350
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: PowerShell Script Block With URL Chain
2+
id: 4a3f2a7d-6402-4e64-a76a-869588ec3b57
3+
version: 1
4+
date: '2023-06-13'
5+
author: Steven Dick
6+
status: production
7+
type: TTP
8+
description: The following analytic identifies a suspicious PowerShell script execution via EventCode 4104 that contains multiple URLs within a function or array.
9+
This is typically found in obfuscated PowerShell or PowerShell executing embedded .NET or binary files that are attempting to download 2nd stage payloads.
10+
During triage, review parallel processes within the same timeframe. Review the full script block to identify other related artifacts.
11+
data_source:
12+
- Powershell 4104
13+
search: '`powershell` EventCode=4104 ScriptBlockText IN ("*http:*","*https:*")
14+
| regex ScriptBlockText="(\"?(https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*))\"?(?:,|\))?){2,}"
15+
| rex max_match=20 field=ScriptBlockText "(?<url>https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*))"
16+
| eval Path = case(isnotnull(Path),Path,true(),"unknown")
17+
| stats count min(_time) as firstTime max(_time) as lastTime list(ScriptBlockText) as command values(Path) as file_name values(UserID) as user values(url) as url dc(url) as url_count by ActivityID, Computer, EventCode
18+
| rename Computer as dest, EventCode as signature_id
19+
| `security_content_ctime(firstTime)`
20+
| `security_content_ctime(lastTime)`
21+
| `powershell_script_block_with_url_chain_filter`'
22+
how_to_implement: The following analytic requires PowerShell operational logs
23+
to be imported. Modify the powershell macro as needed to match the sourcetype or
24+
add index. This analytic is specific to 4104, or PowerShell Script Block Logging.
25+
known_false_positives: Unknown, possible custom scripting.
26+
references:
27+
- https://www.mandiant.com/resources/blog/tracking-evolution-gootloader-operations
28+
- https://thedfirreport.com/2022/05/09/seo-poisoning-a-gootloader-story/
29+
- https://attack.mitre.org/techniques/T1059/001/
30+
tags:
31+
analytic_story:
32+
- Malicious PowerShell
33+
asset_type: Endpoint
34+
confidence: 80
35+
impact: 100
36+
message: A suspicious powershell script used by $user$ on host $dest$ contains $url_count$ URLs in an array, this is commonly used for malware.
37+
mitre_attack_id:
38+
- T1059.001
39+
- T1105
40+
observable:
41+
- name: dest
42+
type: Endpoint
43+
role:
44+
- Victim
45+
- name: user
46+
type: User
47+
role:
48+
- Victim
49+
- name: file_name
50+
type: File Name
51+
role:
52+
- Attacker
53+
- name: url
54+
type: URL String
55+
role:
56+
- Attacker
57+
product:
58+
- Splunk Enterprise
59+
- Splunk Enterprise Security
60+
- Splunk Cloud
61+
required_fields:
62+
- _time
63+
- EventCode
64+
- ActivityID
65+
- Computer
66+
- ScriptBlockText
67+
risk_score: 80
68+
security_domain: endpoint
69+
tests:
70+
- name: True Positive Test
71+
attack_data:
72+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/gootloader/partial_ttps/windows-powershell-xml.log
73+
source: XmlWinEventLog:Microsoft-Windows-PowerShell/Operational
74+
sourcetype: XmlWinEventLog
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: PowerShell WebRequest Using Memory Stream
2+
id: 103affa6-924a-4b53-aff4-1d5075342aab
3+
version: 1
4+
date: '2023-06-13'
5+
author: Steven Dick
6+
status: production
7+
type: TTP
8+
description: This analytic identifies a common fileless malware staging technique of using .NET classes
9+
to directly download a URL payload into memory. The analytic utilizes PowerShell Script Block Logging
10+
(EventCode=4104) to identify suspicious PowerShell execution.
11+
data_source:
12+
- Powershell 4104
13+
search: '`powershell` EventCode=4104 ScriptBlockText IN ("*system.net.webclient*","*system.net.webrequest*") AND ScriptBlockText="*IO.MemoryStream*"
14+
| eval Path = case(isnotnull(Path),Path,true(),"unknown")
15+
| stats count min(_time) as firstTime max(_time) as lastTime list(ScriptBlockText) as command values(Path) as file_name values(UserID) as user by ActivityID, Computer, EventCode
16+
| rename Computer as dest, EventCode as signature_id
17+
| `security_content_ctime(firstTime)`
18+
| `security_content_ctime(lastTime)`
19+
| `powershell_webrequest_using_memory_stream_filter`'
20+
how_to_implement: The following analytic requires PowerShell operational logs
21+
to be imported. Modify the powershell macro as needed to match the sourcetype or
22+
add index. This analytic is specific to 4104, or PowerShell Script Block Logging.
23+
known_false_positives: Unknown, possible custom scripting.
24+
references:
25+
- https://www.mandiant.com/resources/blog/tracking-evolution-gootloader-operations
26+
- https://thedfirreport.com/2022/05/09/seo-poisoning-a-gootloader-story/
27+
- https://attack.mitre.org/techniques/T1059/001/
28+
tags:
29+
analytic_story:
30+
- Malicious PowerShell
31+
asset_type: Endpoint
32+
confidence: 80
33+
impact: 100
34+
message: Powershell webrequest to memory stream behavior. Possible fileless malware staging on $dest$ by $user$.
35+
mitre_attack_id:
36+
- T1059.001
37+
- T1105
38+
- T1027.011
39+
observable:
40+
- name: dest
41+
type: Endpoint
42+
role:
43+
- Victim
44+
- name: user
45+
type: User
46+
role:
47+
- Victim
48+
- name: file_name
49+
type: File Name
50+
role:
51+
- Attacker
52+
product:
53+
- Splunk Enterprise
54+
- Splunk Enterprise Security
55+
- Splunk Cloud
56+
required_fields:
57+
- _time
58+
- EventCode
59+
- ActivityID
60+
- Computer
61+
- ScriptBlockText
62+
risk_score: 80
63+
security_domain: endpoint
64+
tests:
65+
- name: True Positive Test
66+
attack_data:
67+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/gootloader/partial_ttps/windows-powershell-xml.log
68+
source: XmlWinEventLog:Microsoft-Windows-PowerShell/Operational
69+
sourcetype: XmlWinEventLog
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Suspicious Process Executed From Container File
2+
id: d8120352-3b62-411c-8cb6-7b47584dd5e8
3+
version: 1
4+
date: '2023-06-13'
5+
author: Steven Dick
6+
status: production
7+
type: TTP
8+
description: This analytic identifies a suspicious process spawned by another process from within common container/archive file types. This technique was a common technique used by adversaries and malware to execute scripts or evade defenses. This TTP may detect some normal software installation or user behaviors where opening archive files is common.
9+
data_source:
10+
- Sysmon 1
11+
- Windows Security 4688
12+
search: '| tstats `security_content_summariesonly` count values(Processes.process_name) as process_name min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where Processes.process IN ("*.ZIP\\*","*.ISO\\*","*.IMG\\*","*.CAB\\*","*.TAR\\*","*.GZ\\*","*.RAR\\*","*.7Z\\*") AND Processes.action="allowed" by Processes.dest Processes.parent_process Processes.process Processes.user| `drop_dm_object_name(Processes)`| regex process="(?i).*(ZIP|ISO|IMG|CAB|TAR|GZ|RAR|7Z)\\\\.+\.(BAT|BIN|CAB|CMD|COM|CPL|EX_|EXE|GADGET|INF1|INS|INX||HTM|HTML|ISU|JAR|JOB|JS|JSE|LNK|MSC|MSI|MSP|MST|PAF|PIF|PS1|REG|RGS|SCR|SCT|SHB|SHS|U3P|VB|VBE|VBS|VBSCRIPT|WS|WSF|WSH)\"?$" | rex field=process "(?i).+\\\\(?<file_name>[^\\\]+\.(ZIP|ISO|IMG|CAB|TAR|GZ|RAR|7Z))\\\\((.+\\\\)+)?(?<process_name>.+\.(BAT|BIN|CAB|CMD|COM|CPL|EX_|EXE|GADGET|INF1|INS|INX||HTM|HTML|ISU|JAR|JOB|JS|JSE|LNK|MSC|MSI|MSP|MST|PAF|PIF|PS1|REG|RGS|SCR|SCT|SHB|SHS|U3P|VB|VBE|VBS|VBSCRIPT|WS|WSF|WSH))\"?$"| `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)` | `suspicious_process_executed_from_container_file_filter`'
13+
how_to_implement: To successfully implement this search you need to be ingesting information
14+
on process that include the name of the process responsible for the changes from
15+
your endpoints into the `Endpoint` datamodel in the `Processes` node. In addition,
16+
confirm the latest CIM App 4.20 or higher is installed and the latest TA for the
17+
endpoint product.
18+
known_false_positives: Various business process or userland applications and behavior.
19+
references:
20+
- https://www.mandiant.com/resources/blog/tracking-evolution-gootloader-operations
21+
- https://www.crowdstrike.com/blog/weaponizing-disk-image-files-analysis/
22+
- https://attack.mitre.org/techniques/T1204/002/
23+
tags:
24+
analytic_story:
25+
- Unusual Processes
26+
asset_type: Endpoint
27+
confidence: 20
28+
impact: 80
29+
message: A suspicious process $process_name$ was launched from $file_name$ on $dest$.
30+
mitre_attack_id:
31+
- T1204.002
32+
- T1036.008
33+
observable:
34+
- name: dest
35+
type: Endpoint
36+
role:
37+
- Victim
38+
- name: user
39+
type: User
40+
role:
41+
- Victim
42+
- name: file_name
43+
type: File Name
44+
role:
45+
- Attacker
46+
product:
47+
- Splunk Enterprise
48+
- Splunk Enterprise Security
49+
- Splunk Cloud
50+
required_fields:
51+
- _time
52+
- Processes.dest
53+
- Processes.parent_process
54+
- Processes.process
55+
- Processes.user
56+
risk_score: 16
57+
security_domain: endpoint
58+
tests:
59+
- name: True Positive Test
60+
attack_data:
61+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/gootloader/partial_ttps/windows-sysmon.log
62+
source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
63+
sourcetype: xmlwineventlog
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Windows Registry Payload Injection
2+
id: c6b2d80f-179a-41a1-b95e-ce5601d7427a
3+
version: 1
4+
date: '2023-06-15'
5+
author: Steven Dick
6+
status: production
7+
type: TTP
8+
description: The following analytic identifies when suspiciouly long data is written to the registry. This behavior is often associated with certain fileless malware threats or persistence techniques used by threat actors. Data stored in the registy is considered fileless since it does not get written to disk and is traditionally not well defended since normal users can modify thier own registry.
9+
data_source:
10+
- Sysmon EventID 1
11+
search: '| tstats `security_content_summariesonly` count min(_time) AS firstTime max(_time) AS lastTime FROM datamodel=Endpoint.Processes BY _time span=1h Processes.user Processes.process_id Processes.process_name Processes.process Processes.process_path Processes.dest Processes.parent_process_name Processes.parent_process Processes.process_guid| `drop_dm_object_name(Processes)` | join max=0 dest process_guid [| tstats `security_content_summariesonly` count from datamodel=Endpoint.Registry where Registry.registry_value_data=* by _time span=1h Registry.dest Registry.registry_path Registry.registry_value_name Registry.process_guid Registry.registry_value_data Registry.registry_key_name
12+
| `drop_dm_object_name(Registry)`
13+
| eval reg_data_len = len(registry_value_data)
14+
| where reg_data_len > 512] | fields firstTime lastTime dest user parent_process_name parent_process process_name process_path process registry_key_name registry_path registry_value_name registry_value_data process_guid | where isnotnull(registry_value_data)| `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`| `windows_registry_payload_injection_filter`'
15+
how_to_implement: The following analytic requires Sysmon or Windows logging with command line and registry modification logging enabled. Use filter to remove known environment known false positives prior to full production usage.
16+
known_false_positives: Unknown, possible custom scripting.
17+
references:
18+
- https://www.mandiant.com/resources/blog/tracking-evolution-gootloader-operations
19+
- https://www.trendmicro.com/vinfo/us/security/news/cybercrime-and-digital-threats/kovter-an-evolving-malware-gone-fileless
20+
- https://attack.mitre.org/techniques/T1027/011/
21+
tags:
22+
analytic_story:
23+
- Unusual Processes
24+
asset_type: Endpoint
25+
confidence: 60
26+
impact: 100
27+
message: The process $process_name$ added a suspicious length of registry data on $dest$.
28+
mitre_attack_id:
29+
- T1027
30+
- T1027.011
31+
observable:
32+
- name: dest
33+
type: Endpoint
34+
role:
35+
- Victim
36+
- name: user
37+
type: User
38+
role:
39+
- Victim
40+
- name: process
41+
type: Process
42+
role:
43+
- Attacker
44+
- name: process_name
45+
type: Process
46+
role:
47+
- Attacker
48+
product:
49+
- Splunk Enterprise
50+
- Splunk Enterprise Security
51+
- Splunk Cloud
52+
required_fields:
53+
- _time
54+
- user
55+
- dest
56+
- process_id
57+
- process_name
58+
- process
59+
- process_path
60+
- parent_process_name
61+
- parent_process
62+
- process_guid
63+
- registry_path
64+
- registry_value_name
65+
- registry_value_data
66+
- registry_key_name
67+
risk_score: 60
68+
security_domain: endpoint
69+
tests:
70+
- name: True Positive Test
71+
attack_data:
72+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/gootloader/partial_ttps/windows-sysmon.log
73+
source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
74+
sourcetype: xmlwineventlog
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Windows Scheduled Task Service Spawned Shell
2+
id: d8120352-3b62-4e3c-8cb6-7b47584dd5e8
3+
version: 1
4+
date: '2023-06-13'
5+
author: Steven Dick
6+
status: production
7+
type: TTP
8+
description: The following analytic identifies when the Task Scheduler service "svchost.exe -k netsvcs -p -s Schedule" is the parent process to common command line, scripting, or shell execution binaries. Attackers often abuse the task scheduler service with these binaries as an execution and persistence mechanism in order to blend in with normal Windows operations. This TTP is also commonly seen for legitimate purposes such as business scripts or application updates.
9+
data_source:
10+
- Sysmon 1
11+
- Windows Security 4688
12+
search: '| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where
13+
Processes.parent_process="*\\system32\\svchost.exe*" AND Processes.parent_process="*-k*" AND Processes.parent_process= "*netsvcs*" AND Processes.parent_process="*-p*" AND Processes.parent_process="*-s*" AND Processes.parent_process="*Schedule*" Processes.process_name
14+
IN("powershell.exe", "wscript.exe", "cscript.exe", "cmd.exe", "sh.exe", "ksh.exe", "zsh.exe", "bash.exe", "scrcons.exe","pwsh.exe")
15+
by Processes.dest Processes.user Processes.parent_process Processes.process_name Processes.process Processes.process_id Processes.parent_process_id Processes.parent_process_name
16+
| `drop_dm_object_name(Processes)`
17+
| `security_content_ctime(firstTime)`
18+
| `security_content_ctime(lastTime)`
19+
| `windows_scheduled_task_service_spawned_shell_filter`'
20+
how_to_implement: The following analytic requires Sysmon or Windows logging with command line logging enabled. Use filter to remove known environment known false positives prior to full production usage.
21+
known_false_positives: Unknown, possible custom scripting.
22+
references:
23+
- https://www.mandiant.com/resources/blog/tracking-evolution-gootloader-operations
24+
- https://nasbench.medium.com/a-deep-dive-into-windows-scheduled-tasks-and-the-processes-running-them-218d1eed4cce
25+
- https://attack.mitre.org/techniques/T1053/005/
26+
tags:
27+
analytic_story:
28+
- Windows Persistence Techniques
29+
asset_type: Endpoint
30+
confidence: 25
31+
impact: 80
32+
message: A windows scheduled task spawned the shell application $process_name$ on $dest$.
33+
mitre_attack_id:
34+
- T1053.005
35+
- T1059
36+
observable:
37+
- name: dest
38+
type: Endpoint
39+
role:
40+
- Victim
41+
- name: user
42+
type: User
43+
role:
44+
- Victim
45+
- name: process
46+
type: Process Name
47+
role:
48+
- Attacker
49+
product:
50+
- Splunk Enterprise
51+
- Splunk Enterprise Security
52+
- Splunk Cloud
53+
required_fields:
54+
- _time
55+
- Processes.dest
56+
- Processes.user
57+
- Processes.parent_process
58+
- Processes.process_name
59+
- Processes.process
60+
- Processes.process_id
61+
- Processes.parent_process_id
62+
- Processes.parent_process_name
63+
risk_score: 20
64+
security_domain: endpoint
65+
tests:
66+
- name: True Positive Test
67+
attack_data:
68+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/gootloader/partial_ttps/windows-sysmon.log
69+
source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
70+
sourcetype: xmlwineventlog

0 commit comments

Comments
 (0)