updating the detection

This commit is contained in:
d1vious
2022-02-14 13:47:06 -05:00
parent 0a2618f686
commit 1cdd6386f3
2 changed files with 108 additions and 4 deletions
@@ -15,10 +15,7 @@ description: The following hunting analytic identifies PowerShell commands utili
For example w, win, windowsty and so forth. In addition, through our research it
was identified that PowerShell will interpret different command switch types beyond
the hyphen. We have added endash, emdash, horizontal bar, and forward slash.
search: '| from pulsar("d156ed3a-1254-469a-bffc-9dd6eda97ac6", "persistent://ssa/egress/decorated-events-research")
| eval input_event=deserialize_json_object(value)
| select input_event
| eval _datamodels=ucast(map_get(input_event, "_datamodels"), "collection<string>", []), body={}
search: '| from read_ssa_enriched_events()
| eval timestamp=parse_long(ucast(map_get(input_event, "_time"), "string", null)), cmd_line=lower(ucast(map_get(input_event, "process"),
"string", null)), process_name=lower(ucast(map_get(input_event, "process_name"),
"string", null)), process_path=ucast(map_get(input_event, "process_path"), "string",
@@ -0,0 +1,107 @@
author: Jose Hernandez, David Dorsey, Michael Haag Splunk
datamodel:
- Endpoint
date: '2022-02-11'
description: The following hunting analytic identifies PowerShell commands utilizing
the WindowStyle parameter to hide the window on the compromised endpoint. This combination
of command-line options is suspicious because it is overriding the default PowerShell
execution policy, attempts to hide its activity from the user, and connects to the
Internet. Removed in this version of the query is New-Object. The analytic identifies
all variations of WindowStyle, as PowerShell allows the ability to shorten the parameter.
For example w, win, windowsty and so forth. In addition, through our research it
was identified that PowerShell will interpret different command switch types beyond
the hyphen. We have added endash, emdash, horizontal bar, and forward slash.
how_to_implement: You must be ingesting data that records process activity from your
hosts to populate the Endpoint data model in the Processes node. You must also be
ingesting logs with both the process name and command line from your endpoints.
The command-line arguments are mapped to the "process" field in the Endpoint data
model.
id: 477e068e-8b6d-11ec-b6c1-81af21670352
known_false_positives: Legitimate process can have this combination of command-line
options, but it's not common.
name: Windows Powershell Connect to Internet With Hidden Window
product:
- Splunk Behavioral Analytics
references:
- https://regexr.com/663rr
- https://github.com/redcanaryco/AtomicTestHarnesses/blob/master/TestHarnesses/T1059.001_PowerShell/OutPowerShellCommandLineParameter.ps1
- https://ss64.com/ps/powershell.html
- https://twitter.com/M_haggis/status/1440758396534214658?s=20
- https://blog.netlab.360.com/ten-families-of-malicious-samples-are-spreading-using-the-log4j2-vulnerability-now/
risk_message: PowerShell processes $process$ started with parameters to modify the
execution policy of the run, run in a hidden window, and connect to the Internet
on host $dest$ executed by user $user$.
search: '| from read_ssa_enriched_events() | eval timestamp=parse_long(ucast(map_get(input_event,
"_time"), "string", null)), cmd_line=lower(ucast(map_get(input_event, "process"),
"string", null)), process_name=lower(ucast(map_get(input_event, "process_name"),
"string", null)), process_path=ucast(map_get(input_event, "process_path"), "string",
null), parent_process_name=ucast(map_get(input_event, "parent_process_name"), "string",
null), event_id=ucast(map_get(input_event, "event_id"), "string", null) | where
cmd_line IS NOT NULL AND process_name IS NOT NULL | where process_name="pwsh.exe"
OR process_name="pwsh.exe" OR process_name="sqlps.exe" OR process_name="sqltoolsps.exe"
OR process_name="powershell.exe" OR process_name="powershell_ise.exe" | where match_regex(cmd_line,
/(?i)[\\-|\\/|\u2013\|\u2014|\u2015]w(in*d*o*w*s*t*y*l*e*)*\\s+[^-]/)=true | eval
start_time=timestamp, end_time=timestamp, entities=mvappend(ucast(map_get(input_event,
"dest_user_id"), "string", null), ucast(map_get(input_event, "dest_device_id"),
"string", null)), body=create_map(["event_id", event_id, "cmd_line", cmd_line, "process_name",
process_name, "parent_process_name", parent_process_name, "process_path", process_path])
| into write_ssa_detected_events();'
tags:
analytic_story:
- Malicious PowerShell
- Possible Backdoor Activity Associated With MUDCARP Espionage Campaigns
- HAFNIUM Group
- Log4Shell CVE-2021-44228
automated_detection_testing: passed
cis20:
- CIS 8
confidence: 70
context:
- Source:Endpoint
- Stage:Exfiltration
dataset:
- https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1059.001/hidden_powershell/hidden_windows-security.log
impact: 50
kill_chain_phases:
- Exfiltration
message: PowerShell processes $process$ started with parameters to modify the execution
policy of the run, run in a hidden window, and connect to the Internet on host
$dest$ executed by user $user$.
mitre_attack_id:
- T1020
nist:
- PR.PT
- DE.CM
observable:
- name: dest_user_id
role:
- Victim
type: User
- name: dest_device_id
role:
- Victim
type: Hostname
- name: parent_process_name
role:
- Parent Process
type: Parent Process
- name: process_name
role:
- Child Process
type: Process
product:
- Splunk Behavioral Analytics
required_fields:
- _time
- dest_device_id
- process_name
- parent_process_name
- process_path
- dest_user_id
- process
- cmd_line
risk_score: 35
risk_severity: low
security_domain: endpoint
type: Anomaly
version: 1