Files
splunk-security_content/detections/endpoint/powershell_webrequest_using_memory_stream.yml
2023-08-07 12:06:24 -07:00

70 lines
2.5 KiB
YAML

name: PowerShell WebRequest Using Memory Stream
id: 103affa6-924a-4b53-aff4-1d5075342aab
version: 1
date: '2023-06-13'
author: Steven Dick
status: production
type: TTP
description: This analytic identifies a common fileless malware staging technique of using .NET classes
to directly download a URL payload into memory. The analytic utilizes PowerShell Script Block Logging
(EventCode=4104) to identify suspicious PowerShell execution.
data_source:
- Powershell 4104
search: '`powershell` EventCode=4104 ScriptBlockText IN ("*system.net.webclient*","*system.net.webrequest*") AND ScriptBlockText="*IO.MemoryStream*"
| eval Path = case(isnotnull(Path),Path,true(),"unknown")
| 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
| rename Computer as dest, EventCode as signature_id
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `powershell_webrequest_using_memory_stream_filter`'
how_to_implement: The following analytic requires PowerShell operational logs
to be imported. Modify the powershell macro as needed to match the sourcetype or
add index. This analytic is specific to 4104, or PowerShell Script Block Logging.
known_false_positives: Unknown, possible custom scripting.
references:
- https://www.mandiant.com/resources/blog/tracking-evolution-gootloader-operations
- https://thedfirreport.com/2022/05/09/seo-poisoning-a-gootloader-story/
- https://attack.mitre.org/techniques/T1059/001/
tags:
analytic_story:
- Malicious PowerShell
asset_type: Endpoint
confidence: 80
impact: 100
message: Powershell webrequest to memory stream behavior. Possible fileless malware staging on $dest$ by $user$.
mitre_attack_id:
- T1059.001
- T1105
- T1027.011
observable:
- name: dest
type: Endpoint
role:
- Victim
- name: user
type: User
role:
- Victim
- name: file_name
type: File Name
role:
- Attacker
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
required_fields:
- _time
- EventCode
- ActivityID
- Computer
- ScriptBlockText
risk_score: 80
security_domain: endpoint
tests:
- name: True Positive Test
attack_data:
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/gootloader/partial_ttps/windows-powershell-xml.log
source: XmlWinEventLog:Microsoft-Windows-PowerShell/Operational
sourcetype: XmlWinEventLog