290763d9bb
* [Security Content] Add Investigation Guides - 4 * Apply suggestions from code review Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> * Update rules/windows/initial_access_script_executing_powershell.toml Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> * lint * Update persistence_user_account_creation.toml * Apply suggestions from code review Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: benironside <91905639+benironside@users.noreply.github.com> Co-authored-by: Joe Peeples <joe.peeples@elastic.co> Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> * . * Fixes and lint * . * . * revert modifications * Apply suggestions from code review Co-authored-by: Joe Peeples <joe.peeples@elastic.co> Co-authored-by: Mika Ayenson <Mikaayenson@users.noreply.github.com> * Update impact_stop_process_service_threshold.toml Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com> Co-authored-by: benironside <91905639+benironside@users.noreply.github.com> Co-authored-by: Joe Peeples <joe.peeples@elastic.co> Co-authored-by: Justin Ibarra <brokensound77@users.noreply.github.com> Co-authored-by: Colson Wilhoit <48036388+DefSecSentinel@users.noreply.github.com> Co-authored-by: Mika Ayenson <Mikaayenson@users.noreply.github.com>
96 lines
3.9 KiB
TOML
96 lines
3.9 KiB
TOML
[metadata]
|
|
creation_date = "2020/02/18"
|
|
maturity = "production"
|
|
updated_date = "2022/03/31"
|
|
|
|
[rule]
|
|
author = ["Elastic"]
|
|
description = """
|
|
Identifies a PowerShell process launched by either cscript.exe or wscript.exe. Observing Windows scripting processes
|
|
executing a PowerShell script, may be indicative of malicious activity.
|
|
"""
|
|
from = "now-9m"
|
|
index = ["winlogbeat-*", "logs-endpoint.events.*", "logs-windows.*"]
|
|
language = "eql"
|
|
license = "Elastic License v2"
|
|
name = "Windows Script Executing PowerShell"
|
|
note = """## Triage and analysis
|
|
|
|
### Investigating Windows Script Executing PowerShell
|
|
|
|
The Windows Script Host (WSH) is an Windows automation technology, which is ideal for non-interactive scripting needs,
|
|
such as logon scripting, administrative scripting, and machine automation.
|
|
|
|
Attackers commonly use WSH scripts as their initial access method, acting like droppers for second stage payloads, but
|
|
can also use them to download tools and utilities needed to accomplish their goals.
|
|
|
|
This rule looks for the spawn of the `powershell.exe` process with `cscript.exe` or `wscript.exe` as its parent process.
|
|
|
|
#### Possible investigation steps
|
|
|
|
- Investigate the process execution chain (parent process tree).
|
|
- Investigate commands executed by the spawned PowerShell process.
|
|
- Retrieve the script file(s) involved:
|
|
- Use a sandboxed malware analysis system to perform analysis.
|
|
- Observe attempts to contact external domains and addresses.
|
|
- Use the PowerShell Get-FileHash cmdlet to get the SHA-256 hash value of the file.
|
|
- Search for the existence and reputation of this file in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
|
|
- Manually analyze the script to determine if malicious capabilities are present.
|
|
- Determine how the script file was delivered (email attachment, dropped by other processes, etc.).
|
|
- Investigate other alerts related to the user/host in the last 48 hours.
|
|
|
|
### False positive analysis
|
|
|
|
- The usage of these script engines by regular users is unlikely. In the case of authorized benign true positives
|
|
(B-TPs), exceptions can be added.
|
|
|
|
### 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.
|
|
- If the triage identified malware, search the environment for additional compromised hosts.
|
|
- Implement any temporary network rules, procedures, and segmentation required to contain the malware.
|
|
- Immediately block the identified indicators of compromise (IoCs).
|
|
- Remove and block malicious artifacts identified on the triage.
|
|
- 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.
|
|
- Reimage the host operating system and restore compromised files to clean versions.
|
|
|
|
## Config
|
|
|
|
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.
|
|
"""
|
|
risk_score = 21
|
|
rule_id = "f545ff26-3c94-4fd0-bd33-3c7f95a3a0fc"
|
|
severity = "low"
|
|
tags = ["Elastic", "Host", "Windows", "Threat Detection", "Initial Access"]
|
|
timestamp_override = "event.ingested"
|
|
type = "eql"
|
|
|
|
query = '''
|
|
process where event.type in ("start", "process_started") and
|
|
process.parent.name : ("cscript.exe", "wscript.exe") and process.name : "powershell.exe"
|
|
'''
|
|
|
|
|
|
[[rule.threat]]
|
|
framework = "MITRE ATT&CK"
|
|
[[rule.threat.technique]]
|
|
id = "T1566"
|
|
name = "Phishing"
|
|
reference = "https://attack.mitre.org/techniques/T1566/"
|
|
[[rule.threat.technique.subtechnique]]
|
|
id = "T1566.001"
|
|
name = "Spearphishing Attachment"
|
|
reference = "https://attack.mitre.org/techniques/T1566/001/"
|
|
|
|
|
|
|
|
[rule.threat.tactic]
|
|
id = "TA0001"
|
|
name = "Initial Access"
|
|
reference = "https://attack.mitre.org/tactics/TA0001/"
|
|
|