From 27da0d6ed74032bae10f250d162b2bbabb4dc0f3 Mon Sep 17 00:00:00 2001 From: Jonhnathan Date: Mon, 18 Oct 2021 17:50:16 -0300 Subject: [PATCH] [New Rule] Suspicious Portable Executable Encoded in Powershell Script (#1562) * Create execution_posh_portable_executable.toml * Add wildcard * Remove the wildcard * Update rules/windows/execution_posh_portable_executable.toml Co-authored-by: Justin Ibarra Co-authored-by: Justin Ibarra (cherry picked from commit f50fb1d61bdd0fe68eca19ce0cb831af2b3a5d92) --- .../execution_posh_portable_executable.toml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 rules/windows/execution_posh_portable_executable.toml diff --git a/rules/windows/execution_posh_portable_executable.toml b/rules/windows/execution_posh_portable_executable.toml new file mode 100644 index 000000000..a0a2494ce --- /dev/null +++ b/rules/windows/execution_posh_portable_executable.toml @@ -0,0 +1,50 @@ +[metadata] +creation_date = "2021/10/15" +maturity = "production" +updated_date = "2021/10/15" + +[rule] +author = ["Elastic"] +description = """ +This rule detects the presence of Portable Executables in a PowerShell Script by Looking for its encoded header. +Attackers embed PEs into PowerShell Scripts for Injecting them into the memory, avoiding defenses by not writing to +disk., +""" +from = "now-9m" +index = ["winlogbeat-*", "logs-windows.*"] +language = "kuery" +license = "Elastic License v2" +name = "Suspicious Portable Executable Encoded in Powershell Script" +risk_score = 47 +rule_id = "ad84d445-b1ce-4377-82d9-7c633f28bf9a" +severity = "medium" +tags = ["Elastic", "Host", "Windows", "Threat Detection", "Execution"] +timestamp_override = "event.ingested" +type = "query" + +query = ''' +event.code:"4104" and + powershell.file.script_block_text : ( + TVqQAAMAAAAEAAAA + ) +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" + +[[rule.threat.technique]] +id = "T1059" +name = "Command and Scripting Interpreter" +reference = "https://attack.mitre.org/techniques/T1059/" + + [[rule.threat.technique.subtechnique]] + id = "T1059.001" + name = "PowerShell" + reference = "https://attack.mitre.org/techniques/T1059/001/" + +[rule.threat.tactic] +id = "TA0002" +name = "Execution" +reference = "https://attack.mitre.org/tactics/TA0002/" +