Detection rules › Sigma

Winrs Local Command Execution

Status
experimental
Severity
high
Log source
category process_creation, product windows
Author
Liran Ravich, Nasreddine Bencherchali
Source
github.com/SigmaHQ/sigma

Detects the execution of Winrs.exe where it is used to execute commands locally. Commands executed this way are launched under Winrshost.exe and can represent proxy execution used for defense evasion or lateral movement.

Known false positives

  • Unlikely

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Winrs Local Command Execution
id: bcfece3d-56fe-4545-9931-3b8e92927db1
status: experimental
description: |
    Detects the execution of Winrs.exe where it is used to execute commands locally.
    Commands executed this way are launched under Winrshost.exe and can represent proxy execution used for defense evasion or lateral movement.
references:
    - https://cardinalops.com/blog/living-off-winrm-abusing-complexity-in-remote-management/
    - https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/winrs
author: Liran Ravich, Nasreddine Bencherchali
date: 2025-10-22
tags:
    - attack.lateral-movement
    - attack.stealth
    - attack.t1021.006
    - attack.t1218
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        # Note: Example of command to simulate (winrm needs to be enabled): "c:\Windows\System32\winrs.exe" calc.exe
        - Image|endswith: '\winrs.exe'
        - OriginalFileName: 'winrs.exe'
    selection_local_ip:
        CommandLine|contains|windash:
            - '/r:localhost'
            - '/r:127.0.0.1'
            - '/r:[::1]'
            - '/remote:localhost'
            - '/remote:127.0.0.1'
            - '/remote:[::1]'
    filter_main_remote:
        CommandLine|contains|windash:
            - "/r:"
            - "/remote:"
    condition: all of selection_* or (selection_img and not 1 of filter_main_*)
falsepositives:
    - Unlikely
level: high

Stages and Predicates

Stage 0: condition

all of selection_* or (selection_img and not 1 of filter_main_*)

Stage 1: selection_img

selection_img:
    - Image|endswith: '\winrs.exe'
    - OriginalFileName: 'winrs.exe'

Stage 2: selection_local_ip

selection_local_ip:
    CommandLine|contains|windash:
        - '/r:localhost'
        - '/r:127.0.0.1'
        - '/r:[::1]'
        - '/remote:localhost'
        - '/remote:127.0.0.1'
        - '/remote:[::1]'

Stage 3: selection_img

selection_img:
    - Image|endswith: '\winrs.exe'
    - OriginalFileName: 'winrs.exe'

Stage 4: not filter_main_remote

filter_main_remote:
    CommandLine|contains|windash:
        - "/r:"
        - "/remote:"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
CommandLinematch/r:excludes:CommandLine field:"CommandLine" value:"/r:"
CommandLinematch/remote:excludes:CommandLine field:"CommandLine" value:"/remote:"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLinematch
  • /r:127.0.0.1 transforms: windash
  • /r:[::1] transforms: windash
  • /r:localhost transforms: windash
  • /remote:127.0.0.1 transforms: windash
  • /remote:[::1] transforms: windash
  • /remote:localhost transforms: windash
field:"CommandLine" kind:match
Imageends_with
  • \winrs.exe corpus 2 (sigma 2)
field:"Image" kind:ends_with value:"\winrs.exe"
OriginalFileNameeq
  • winrs.exe corpus 2 (sigma 1, splunk 1)
field:"OriginalFileName" kind:eq value:"winrs.exe"