Detection rules › Sigma

Remote Code Execute via Winrm.vbs

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Julia Fomina, oscd.community
Source
github.com/SigmaHQ/sigma

Detects an attempt to execute code or create service on remote host via winrm.vbs.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Remote Code Execute via Winrm.vbs
id: 9df0dd3a-1a5c-47e3-a2bc-30ed177646a0
status: test
description: Detects an attempt to execute code or create service on remote host via winrm.vbs.
references:
    - https://twitter.com/bohops/status/994405551751815170
    - https://redcanary.com/blog/lateral-movement-winrm-wmi/
    - https://lolbas-project.github.io/lolbas/Scripts/Winrm/
author: Julia Fomina, oscd.community
date: 2020-10-07
modified: 2023-03-03
tags:
    - attack.stealth
    - attack.t1216
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        # Note: winrm.vbs can only be run by a process named cscript (see "IsCScriptEnv" function)
        - Image|endswith: '\cscript.exe'
        - OriginalFileName: 'cscript.exe'
    selection_cli:
        CommandLine|contains|all:
            - 'winrm'
            - 'invoke Create wmicimv2/Win32_'
            - '-r:http'
    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: '\cscript.exe'
    - OriginalFileName: 'cscript.exe'

Stage 2: selection_cli

selection_cli:
    CommandLine|contains|all:
        - 'winrm'
        - 'invoke Create wmicimv2/Win32_'
        - '-r:http'

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
  • -r:http
  • invoke Create wmicimv2/Win32_
  • winrm corpus 2 (sigma 2)
Imageends_with
  • \cscript.exe corpus 73 (sigma 73)
OriginalFileNameeq
  • cscript.exe corpus 19 (sigma 17, elastic 2)