Detection rules › Sigma

New Remote Desktop Connection Initiated Via Mstsc.EXE

Status
test
Severity
medium
Log source
category process_creation, product windows
Author
frack113
Source
github.com/SigmaHQ/sigma

Detects the usage of "mstsc.exe" with the "/v" flag to initiate a connection to a remote server. Adversaries may use valid accounts to log into a computer using the Remote Desktop Protocol (RDP). The adversary may then perform actions as the logged-on user.

Known false positives

  • WSL (Windows Sub System For Linux)

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: New Remote Desktop Connection Initiated Via Mstsc.EXE
id: 954f0af7-62dd-418f-b3df-a84bc2c7a774
status: test
description: |
    Detects the usage of "mstsc.exe" with the "/v" flag to initiate a connection to a remote server.
    Adversaries may use valid accounts to log into a computer using the Remote Desktop Protocol (RDP). The adversary may then perform actions as the logged-on user.
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1021.001/T1021.001.md#t1021001---remote-desktop-protocol
    - https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mstsc
author: frack113
date: 2022-01-07
modified: 2024-06-04
tags:
    - attack.lateral-movement
    - attack.t1021.001
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\mstsc.exe'
        - OriginalFileName: 'mstsc.exe'
    selection_cli:
        CommandLine|contains|windash: ' /v:'
    filter_optional_wsl:
        # Example: mstsc.exe /v:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /hvsocketserviceid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /silent /wslg /plugin:WSLDVC /wslgsharedmemorypath:WSL\XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\wslg C:\ProgramData\Microsoft\WSL\wslg.rdp
        ParentImage: 'C:\Windows\System32\lxss\wslhost.exe'
        CommandLine|contains: 'C:\ProgramData\Microsoft\WSL\wslg.rdp'
    condition: all of selection_* and not 1 of filter_optional_*
falsepositives:
    - WSL (Windows Sub System For Linux)
level: medium

Stages and Predicates

Stage 0: condition

all of selection_* and not 1 of filter_optional_*

Stage 1: selection_img

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

Stage 2: selection_cli

selection_cli:
    CommandLine|contains|windash: ' /v:'

Stage 3: not filter_optional_wsl

filter_optional_wsl:
    ParentImage: 'C:\Windows\System32\lxss\wslhost.exe'
    CommandLine|contains: 'C:\ProgramData\Microsoft\WSL\wslg.rdp'

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
CommandLinematchC:\ProgramData\Microsoft\WSL\wslg.rdpexcludes:CommandLine field:"CommandLine" value:"C:\ProgramData\Microsoft\WSL\wslg.rdp"
ParentImageeqC:\Windows\System32\lxss\wslhost.exeexcludes:ParentImage field:"ParentImage" value:"C:\Windows\System32\lxss\wslhost.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLinematch
  • /v: transforms: windash
field:"CommandLine" kind:match value:" /v:"
Imageends_with
  • \mstsc.exe corpus 6 (sigma 6)
field:"Image" kind:ends_with value:"\mstsc.exe"
OriginalFileNameeq
  • mstsc.exe corpus 5 (sigma 4, elastic 1)
field:"OriginalFileName" kind:eq value:"mstsc.exe"