Detection rules › Sigma

Suspicious Invoke-WebRequest Execution With DirectIP

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects calls to PowerShell with Invoke-WebRequest cmdlet using direct IP access

MITRE ATT&CK coverage

TacticTechniques
Command & ControlT1105 Ingress Tool Transfer

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Suspicious Invoke-WebRequest Execution With DirectIP
id: 1edff897-9146-48d2-9066-52e8d8f80a2f
status: test
description: Detects calls to PowerShell with Invoke-WebRequest cmdlet using direct IP access
references:
    - https://www.huntress.com/blog/critical-vulnerabilities-in-papercut-print-management-software
author: Nasreddine Bencherchali (Nextron Systems)
date: 2023-04-21
tags:
    - attack.command-and-control
    - attack.t1105
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith:
              - '\powershell_ise.exe'
              - '\powershell.exe'
              - '\pwsh.exe'
        - OriginalFileName:
              - 'powershell_ise.EXE'
              - 'PowerShell.EXE'
              - 'pwsh.dll'
    selection_commands:
        CommandLine|contains:
            # These are all aliases of Invoke-WebRequest
            - 'curl '
            - 'Invoke-RestMethod'
            - 'Invoke-WebRequest'
            - ' irm ' # Space before and after to avoid false positives with 'irm' as a substring
            - 'iwr '
            - 'wget '
    selection_ip:
        # In case of FP with local IPs add additional filters
        CommandLine|contains:
            - '://1'
            - '://2'
            - '://3'
            - '://4'
            - '://5'
            - '://6'
            - '://7'
            - '://8'
            - '://9'
    condition: all of selection_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

selection_img:
    - Image|endswith:
          - '\powershell_ise.exe'
          - '\powershell.exe'
          - '\pwsh.exe'
    - OriginalFileName:
          - 'powershell_ise.EXE'
          - 'PowerShell.EXE'
          - 'pwsh.dll'

Stage 2: selection_commands

selection_commands:
    CommandLine|contains:
        - 'curl '
        - 'Invoke-RestMethod'
        - 'Invoke-WebRequest'
        - ' irm '
        - 'iwr '
        - 'wget '

Stage 3: selection_ip

selection_ip:
    CommandLine|contains:
        - '://1'
        - '://2'
        - '://3'
        - '://4'
        - '://5'
        - '://6'
        - '://7'
        - '://8'
        - '://9'

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
CommandLinematch
  • irm corpus 2 (sigma 2)
  • ://1 corpus 3 (sigma 3)
  • ://2 corpus 3 (sigma 3)
  • ://3 corpus 3 (sigma 3)
  • ://4 corpus 3 (sigma 3)
  • ://5 corpus 3 (sigma 3)
  • ://6 corpus 3 (sigma 3)
  • ://7 corpus 3 (sigma 3)
  • ://8 corpus 3 (sigma 3)
  • ://9 corpus 3 (sigma 3)
  • Invoke-RestMethod corpus 5 (sigma 5)
  • Invoke-WebRequest corpus 13 (sigma 10, elastic 1, chronicle 1, kusto 1)
  • curl corpus 12 (sigma 11, chronicle 1)
  • iwr corpus 13 (sigma 11, chronicle 2)
  • wget corpus 8 (sigma 7, chronicle 1)
Imageends_with
  • \powershell.exe corpus 182 (sigma 182)
  • \powershell_ise.exe corpus 41 (sigma 41)
  • \pwsh.exe corpus 168 (sigma 168)
OriginalFileNameeq
  • PowerShell.EXE corpus 120 (sigma 84, splunk 30, elastic 6)
  • powershell_ise.EXE corpus 51 (splunk 30, sigma 18, elastic 3)
  • pwsh.dll corpus 112 (sigma 79, splunk 30, elastic 3)