mirror of
https://github.com/splunk/security_content
synced 2026-06-08 17:32:49 +00:00
75 lines
3.0 KiB
YAML
75 lines
3.0 KiB
YAML
name: PowerShell Script Block With URL Chain
|
|
id: 4a3f2a7d-6402-4e64-a76a-869588ec3b57
|
|
version: 1
|
|
date: '2023-06-13'
|
|
author: Steven Dick
|
|
status: production
|
|
type: TTP
|
|
description: The following analytic identifies a suspicious PowerShell script execution via EventCode 4104 that contains multiple URLs within a function or array.
|
|
This is typically found in obfuscated PowerShell or PowerShell executing embedded .NET or binary files that are attempting to download 2nd stage payloads.
|
|
During triage, review parallel processes within the same timeframe. Review the full script block to identify other related artifacts.
|
|
data_source:
|
|
- Powershell 4104
|
|
search: '`powershell` EventCode=4104 ScriptBlockText IN ("*http:*","*https:*")
|
|
| regex ScriptBlockText="(\"?(https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*))\"?(?:,|\))?){2,}"
|
|
| 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()@:%_\+.~#?&\/=]*))"
|
|
| 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 values(url) as url dc(url) as url_count by ActivityID, Computer, EventCode
|
|
| rename Computer as dest, EventCode as signature_id
|
|
| `security_content_ctime(firstTime)`
|
|
| `security_content_ctime(lastTime)`
|
|
| `powershell_script_block_with_url_chain_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: A suspicious powershell script used by $user$ on host $dest$ contains $url_count$ URLs in an array, this is commonly used for malware.
|
|
mitre_attack_id:
|
|
- T1059.001
|
|
- T1105
|
|
observable:
|
|
- name: dest
|
|
type: Endpoint
|
|
role:
|
|
- Victim
|
|
- name: user
|
|
type: User
|
|
role:
|
|
- Victim
|
|
- name: file_name
|
|
type: File Name
|
|
role:
|
|
- Attacker
|
|
- name: url
|
|
type: URL String
|
|
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
|