Detection rules › Elastic

Suspicious PowerShell Downloads

Source
github.com/elastic/protections-artifacts

Identifies PowerShell processes that attempted to download files and were descendants of Microsoft Office, document viewers, web browsers, or other business application software.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies PowerShell processes that attempted to download files and were descendants of Microsoft Office, document
viewers, web browsers, or other business application software.
"""
id = "7200673e-588c-45d5-be48-bc5c7a908d6b"
license = "Elastic License v2"
name = "Suspicious PowerShell Downloads"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine",
    "https://www.elastic.co/security-labs/dipping-into-danger",
]
version = "1.0.32"

query = '''
process where event.action == "start" and
  (process.name : ("powershell.exe", "pwsh.exe") or process.pe.original_file_name : ("powershell.exe", "pwsh.exe")) and
   process.command_line : ("*.downloadstring*", "*.downloadfile*", "*.downloaddata*", "*BitsTransfer*") and
   not process.Ext.token.integrity_level_name : "system" and
  (process.parent.name : (
      "winword.exe",
      "excel.exe",
      "outlook.exe",
      "powerpnt.exe",
      "eqnedt32.exe",
      "fltldr.exe",
      "mspub.exe",
      "msaccess.exe",
      "acrord32.exe",
      "rdrcef.exe",
      "foxitphantomPDF.exe",
      "foxitreader.exe",
      "firefox.exe",
      "chrome.exe",
      "iexplore.exe",
      "opera.exe",
      "plugin-container.exe",
      "safari.exe",
      "microsoftedge.exe",
      "w3wp.exe",
      "httpd.exe",
      "nginx.exe",
      "php.exe",
      "php-cgi.exe",
      "tomcat.exe",
      "msbuild.exe",
      "mshta.exe"
      ) or
  descendant of [process where event.action == "start" and
    process.parent.name : (
      "winword.exe",
      "excel.exe",
      "outlook.exe",
      "powerpnt.exe",
      "eqnedt32.exe",
      "fltldr.exe",
      "mspub.exe",
      "msaccess.exe",
      "acrord32.exe",
      "rdrcef.exe",
      "foxitphantomPDF.exe",
      "foxitreader.exe",
      "firefox.exe",
      "chrome.exe",
      "iexplore.exe",
      "opera.exe",
      "plugin-container.exe",
      "safari.exe",
      "microsoftedge.exe",
      "w3wp.exe",
      "httpd.exe",
      "nginx.exe",
      "php.exe",
      "php-cgi.exe",
      "tomcat.exe"
    )]) and
  not process.parent.executable : "?:\\Program Files\\JumpCloud\\jumpcloud-agent.exe" and
  not (process.command_line : "*https://us.ri.logicnow.com*" and process.parent.name : "cscript.exe")
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"

[[threat.technique.subtechnique]]
id = "T1566.002"
name = "Spearphishing Link"
reference = "https://attack.mitre.org/techniques/T1566/002/"



[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
  (process.name : ("powershell.exe", "pwsh.exe") or process.pe.original_file_name : ("powershell.exe", "pwsh.exe")) and
   process.command_line : ("*.downloadstring*", "*.downloadfile*", "*.downloaddata*", "*BitsTransfer*") and
   not process.Ext.token.integrity_level_name : "system" and
  (process.parent.name : (
      "winword.exe",
      "excel.exe",
      "outlook.exe",
      "powerpnt.exe",
      "eqnedt32.exe",
      "fltldr.exe",
      "mspub.exe",
      "msaccess.exe",
      "acrord32.exe",
      "rdrcef.exe",
      "foxitphantomPDF.exe",
      "foxitreader.exe",
      "firefox.exe",
      "chrome.exe",
      "iexplore.exe",
      "opera.exe",
      "plugin-container.exe",
      "safari.exe",
      "microsoftedge.exe",
      "w3wp.exe",
      "httpd.exe",
      "nginx.exe",
      "php.exe",
      "php-cgi.exe",
      "tomcat.exe",
      "msbuild.exe",
      "mshta.exe"
      ) or
  descendant of [process where event.action == "start" and
    process.parent.name : (
      "winword.exe",
      "excel.exe",
      "outlook.exe",
      "powerpnt.exe",
      "eqnedt32.exe",
      "fltldr.exe",
      "mspub.exe",
      "msaccess.exe",
      "acrord32.exe",
      "rdrcef.exe",
      "foxitphantomPDF.exe",
      "foxitreader.exe",
      "firefox.exe",
      "chrome.exe",
      "iexplore.exe",
      "opera.exe",
      "plugin-container.exe",
      "safari.exe",
      "microsoftedge.exe",
      "w3wp.exe",
      "httpd.exe",
      "nginx.exe",
      "php.exe",
      "php-cgi.exe",
      "tomcat.exe"
    )]) and
  not process.parent.executable : "?:\\Program Files\\JumpCloud\\jumpcloud-agent.exe" and
  not (process.command_line : "*https://us.ri.logicnow.com*" and process.parent.name : "cscript.exe")

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • *.downloaddata* corpus 2 (sigma 1, elastic 1)
  • *.downloadfile* corpus 4 (sigma 2, elastic 1, chronicle 1)
  • *.downloadstring* corpus 3 (sigma 2, elastic 1)
  • *BitsTransfer*
field:"CommandLine" kind:wildcard
process.namewildcard
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • pwsh.exe corpus 77 (elastic 48, splunk 29)
field:"process_name" kind:wildcard
process.parent.namewildcard
  • acrord32.exe corpus 3 (elastic 3)
  • chrome.exe corpus 9 (elastic 9)
  • eqnedt32.exe corpus 9 (elastic 9)
  • excel.exe corpus 28 (elastic 27, splunk 1)
  • firefox.exe corpus 9 (elastic 9)
  • fltldr.exe corpus 7 (elastic 7)
  • foxitphantomPDF.exe corpus 3 (elastic 3)
  • foxitreader.exe corpus 3 (elastic 3)
  • httpd.exe corpus 2 (elastic 2)
  • iexplore.exe corpus 8 (elastic 8)
  • microsoftedge.exe corpus 2 (elastic 2)
  • msaccess.exe corpus 12 (elastic 12)
  • msbuild.exe corpus 4 (elastic 4)
  • mshta.exe corpus 24 (elastic 22, splunk 2)
  • mspub.exe corpus 11 (elastic 11)
  • nginx.exe corpus 2 (elastic 2)
  • opera.exe corpus 4 (elastic 4)
  • outlook.exe corpus 10 (elastic 10)
  • php-cgi.exe corpus 2 (elastic 2)
  • php.exe corpus 2 (elastic 2)
  • plugin-container.exe corpus 2 (elastic 2)
  • powerpnt.exe corpus 23 (elastic 23)
  • rdrcef.exe corpus 2 (elastic 2)
  • safari.exe corpus 3 (elastic 3)
  • tomcat.exe corpus 2 (elastic 2)
  • w3wp.exe corpus 8 (elastic 8)
  • winword.exe corpus 26 (elastic 26)
field:"parent_process_name" kind:wildcard
process.pe.original_file_namewildcard
  • powershell.exe corpus 138 (sigma 84, splunk 30, elastic 24)
  • pwsh.exe corpus 7 (elastic 7)
field:"OriginalFileName" kind:wildcard