Detection rules › Sigma

New Port Forwarding Rule Added Via Netsh.EXE

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Florian Roth (Nextron Systems), omkar72, oscd.community, Swachchhanda Shrawan Poudel
Source
github.com/SigmaHQ/sigma

Detects the execution of netsh commands that configure a new port forwarding (PortProxy) rule

MITRE ATT&CK coverage

TacticTechniques
Command & ControlT1090 Proxy

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: New Port Forwarding Rule Added Via Netsh.EXE
id: 322ed9ec-fcab-4f67-9a34-e7c6aef43614
status: test
description: Detects the execution of netsh commands that configure a new port forwarding (PortProxy) rule
references:
    - https://www.fireeye.com/blog/threat-research/2019/01/bypassing-network-restrictions-through-rdp-tunneling.html
    - https://adepts.of0x.cc/netsh-portproxy-code/
    - https://www.dfirnotes.net/portproxy_detection/
author: Florian Roth (Nextron Systems), omkar72, oscd.community, Swachchhanda Shrawan Poudel
date: 2019-01-29
modified: 2023-09-01
tags:
    - attack.lateral-movement
    - attack.command-and-control
    - attack.t1090
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\netsh.exe'
        - OriginalFileName: 'netsh.exe'
    selection_cli_1:
        CommandLine|contains|all:
            - 'interface'
            - 'portproxy'
            - 'add'
            - 'v4tov4'
    selection_cli_2:
        CommandLine|contains|all:
            # Example: netsh I p a v l=8001 listena=127.0.0.1 connectp=80 c=192.168.1.1
            - 'i ' # interface
            - 'p ' # portproxy
            - 'a ' # add
            - 'v ' # v4tov4
    selection_cli_3:
        CommandLine|contains|all:
            - 'connectp'
            - 'listena'
            - 'c='
    condition: selection_img and 1 of selection_cli_*
falsepositives:
    - Legitimate administration activity
    - WSL2 network bridge PowerShell script used for WSL/Kubernetes/Docker (e.g. https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723)
level: medium

Stages and Predicates

Stage 0: condition

selection_img and 1 of selection_cli_*

Stage 1: selection_img

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

Stage 2: selection_cli_1

selection_cli_1:
    CommandLine|contains|all:
        - 'interface'
        - 'portproxy'
        - 'add'
        - 'v4tov4'

Stage 3: selection_cli_2

selection_cli_2:
    CommandLine|contains|all:
        - 'i '
        - 'p '
        - 'a '
        - 'v '

Stage 4: selection_cli_3

selection_cli_3:
    CommandLine|contains|all:
        - 'connectp'
        - 'listena'
        - 'c='

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
  • a corpus 2 (sigma 2)
  • add corpus 34 (sigma 26, splunk 4, chronicle 2, kusto 2)
  • c=
  • connectp
  • i corpus 2 (sigma 2)
  • interface corpus 2 (sigma 2)
  • listena
  • p corpus 2 (sigma 2)
  • portproxy corpus 2 (sigma 2)
  • v
  • v4tov4
Imageends_with
  • \netsh.exe corpus 28 (sigma 28)
OriginalFileNameeq
  • netsh.exe corpus 23 (sigma 14, splunk 7, elastic 2)