Detection rules › Sigma

Webshell Detection With Command Line Keywords

Status
test
Severity
high
Log source
product windows, category process_creation
Author
Florian Roth (Nextron Systems), Jonhnathan Ribeiro, Anton Kutepov, oscd.community, Chad Hudson, Matt Anderson
Source
github.com/SigmaHQ/sigma

Detects certain command line parameters often used during reconnaissance activity via web shells

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Webshell Detection With Command Line Keywords
id: bed2a484-9348-4143-8a8a-b801c979301c
status: test
description: Detects certain command line parameters often used during reconnaissance activity via web shells
references:
    - https://www.fireeye.com/blog/threat-research/2013/08/breaking-down-the-china-chopper-web-shell-part-ii.html
    - https://unit42.paloaltonetworks.com/bumblebee-webshell-xhunt-campaign/
    - https://www.huntress.com/blog/threat-advisory-oh-no-cleo-cleo-software-actively-being-exploited-in-the-wild
author: Florian Roth (Nextron Systems), Jonhnathan Ribeiro, Anton Kutepov, oscd.community, Chad Hudson, Matt Anderson
date: 2017-01-01
modified: 2024-12-14
tags:
    - attack.persistence
    - attack.discovery
    - attack.t1505.003
    - attack.t1018
    - attack.t1033
    - attack.t1087
logsource:
    category: process_creation
    product: windows
detection:
    selection_webserver_image:
        ParentImage|endswith:
            - '\w3wp.exe'
            - '\php-cgi.exe'
            - '\nginx.exe'
            - '\httpd.exe'
            - '\caddy.exe'
            - '\ws_tomcatservice.exe'
    selection_webserver_characteristics_tomcat1:
        ParentImage|endswith:
            - '\java.exe'
            - '\javaw.exe'
        ParentImage|contains:
            - '-tomcat-'
            - '\tomcat'
    selection_webserver_characteristics_tomcat2:
        ParentImage|endswith:
            - '\java.exe'
            - '\javaw.exe'
        CommandLine|contains:
            - 'catalina.jar'
            - 'CATALINA_HOME'
    selection_susp_net_utility:
        OriginalFileName:
            - 'net.exe'
            - 'net1.exe'
        CommandLine|contains:
            - ' user '
            - ' use '
            - ' group '
    selection_susp_ping_utility:
        OriginalFileName: 'ping.exe'
        CommandLine|contains: ' -n '
    selection_susp_change_dir:
        CommandLine|contains:
            - '&cd&echo'  # china chopper web shell
            - 'cd /d '  # https://www.computerhope.com/cdhlp.htm
    selection_susp_wmic_utility:
        OriginalFileName: 'wmic.exe'
        CommandLine|contains: ' /node:'
    selection_susp_powershell_cli:
        Image|endswith:
            - '\cmd.exe'
            - '\powershell.exe'
            - '\pwsh.exe'
        CommandLine|contains:
            - ' -enc '
            - ' -EncodedCommand '
            - ' -w hidden '
            - ' -windowstyle hidden'
            - '.WebClient).Download'
    selection_susp_misc_discovery_binaries:
        - Image|endswith:
              - '\dsquery.exe'
              - '\find.exe'
              - '\findstr.exe'
              - '\ipconfig.exe'
              - '\netstat.exe'
              - '\nslookup.exe'
              - '\pathping.exe'
              - '\quser.exe'
              - '\schtasks.exe'
              - '\systeminfo.exe'
              - '\tasklist.exe'
              - '\tracert.exe'
              - '\ver.exe'
              - '\wevtutil.exe'
              - '\whoami.exe'
        - OriginalFileName:
              - 'dsquery.exe'
              - 'find.exe'
              - 'findstr.exe'
              - 'ipconfig.exe'
              - 'netstat.exe'
              - 'nslookup.exe'
              - 'pathping.exe'
              - 'quser.exe'
              - 'schtasks.exe'
              - 'sysinfo.exe'
              - 'tasklist.exe'
              - 'tracert.exe'
              - 'ver.exe'
              - 'VSSADMIN.EXE'
              - 'wevtutil.exe'
              - 'whoami.exe'
    selection_susp_misc_discovery_commands:
        CommandLine|contains:
            - ' Test-NetConnection '
            - 'dir \'  # remote dir: dir \<redacted IP #3>\C$:\windows\temp\*.exe
    condition: 1 of selection_webserver_* and 1 of selection_susp_*
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

1 of selection_webserver_* and 1 of selection_susp_*

Stage 1: selection_webserver_image

selection_webserver_image:
    ParentImage|endswith:
        - '\w3wp.exe'
        - '\php-cgi.exe'
        - '\nginx.exe'
        - '\httpd.exe'
        - '\caddy.exe'
        - '\ws_tomcatservice.exe'

Stage 2: selection_webserver_characteristics_tomcat1

selection_webserver_characteristics_tomcat1:
    ParentImage|endswith:
        - '\java.exe'
        - '\javaw.exe'
    ParentImage|contains:
        - '-tomcat-'
        - '\tomcat'

Stage 3: selection_webserver_characteristics_tomcat2

selection_webserver_characteristics_tomcat2:
    ParentImage|endswith:
        - '\java.exe'
        - '\javaw.exe'
    CommandLine|contains:
        - 'catalina.jar'
        - 'CATALINA_HOME'

Stage 4: selection_susp_net_utility

selection_susp_net_utility:
    OriginalFileName:
        - 'net.exe'
        - 'net1.exe'
    CommandLine|contains:
        - ' user '
        - ' use '
        - ' group '

Stage 5: selection_susp_ping_utility

selection_susp_ping_utility:
    OriginalFileName: 'ping.exe'
    CommandLine|contains: ' -n '

Stage 6: selection_susp_change_dir

selection_susp_change_dir:
    CommandLine|contains:
        - '&cd&echo'
        - 'cd /d '

Stage 7: selection_susp_wmic_utility

selection_susp_wmic_utility:
    OriginalFileName: 'wmic.exe'
    CommandLine|contains: ' /node:'

Stage 8: selection_susp_powershell_cli

selection_susp_powershell_cli:
    Image|endswith:
        - '\cmd.exe'
        - '\powershell.exe'
        - '\pwsh.exe'
    CommandLine|contains:
        - ' -enc '
        - ' -EncodedCommand '
        - ' -w hidden '
        - ' -windowstyle hidden'
        - '.WebClient).Download'

Stage 9: selection_susp_misc_discovery_binaries

selection_susp_misc_discovery_binaries:
    - Image|endswith:
          - '\dsquery.exe'
          - '\find.exe'
          - '\findstr.exe'
          - '\ipconfig.exe'
          - '\netstat.exe'
          - '\nslookup.exe'
          - '\pathping.exe'
          - '\quser.exe'
          - '\schtasks.exe'
          - '\systeminfo.exe'
          - '\tasklist.exe'
          - '\tracert.exe'
          - '\ver.exe'
          - '\wevtutil.exe'
          - '\whoami.exe'
    - OriginalFileName:
          - 'dsquery.exe'
          - 'find.exe'
          - 'findstr.exe'
          - 'ipconfig.exe'
          - 'netstat.exe'
          - 'nslookup.exe'
          - 'pathping.exe'
          - 'quser.exe'
          - 'schtasks.exe'
          - 'sysinfo.exe'
          - 'tasklist.exe'
          - 'tracert.exe'
          - 'ver.exe'
          - 'VSSADMIN.EXE'
          - 'wevtutil.exe'
          - 'whoami.exe'

Stage 10: selection_susp_misc_discovery_commands

selection_susp_misc_discovery_commands:
    CommandLine|contains:
        - ' Test-NetConnection '
        - 'dir \'

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
  • -EncodedCommand corpus 2 (sigma 2)
  • -enc corpus 6 (sigma 6)
  • -n corpus 3 (sigma 3)
  • -w hidden corpus 5 (sigma 5)
  • -windowstyle hidden
  • /node:
  • Test-NetConnection
  • group corpus 2 (sigma 2)
  • use corpus 6 (sigma 6)
  • user corpus 3 (sigma 3)
  • &cd&echo corpus 2 (sigma 2)
  • .WebClient).Download
  • CATALINA_HOME corpus 3 (sigma 3)
  • catalina.jar corpus 3 (sigma 3)
  • cd /d
  • dir \
Imageends_with
  • \cmd.exe corpus 130 (sigma 130)
  • \dsquery.exe corpus 2 (sigma 2)
  • \find.exe corpus 8 (sigma 8)
  • \findstr.exe corpus 12 (sigma 12)
  • \ipconfig.exe corpus 5 (sigma 5)
  • \netstat.exe corpus 5 (sigma 5)
  • \nslookup.exe corpus 5 (sigma 5)
  • \pathping.exe
  • \powershell.exe corpus 182 (sigma 182)
  • \pwsh.exe corpus 168 (sigma 168)
  • \quser.exe corpus 2 (sigma 2)
  • \schtasks.exe corpus 56 (sigma 56)
  • \systeminfo.exe corpus 11 (sigma 11)
  • \tasklist.exe corpus 5 (sigma 5)
  • \tracert.exe
  • \ver.exe
  • \wevtutil.exe corpus 9 (sigma 9)
  • \whoami.exe corpus 19 (sigma 19)
OriginalFileNameeq
  • VSSADMIN.EXE corpus 4 (sigma 3, elastic 1)
  • dsquery.exe corpus 3 (sigma 2, elastic 1)
  • find.exe corpus 7 (sigma 7)
  • findstr.exe corpus 12 (sigma 12)
  • ipconfig.exe corpus 2 (sigma 1, splunk 1)
  • net.exe corpus 28 (sigma 19, elastic 7, splunk 2)
  • net1.exe corpus 44 (sigma 19, splunk 19, elastic 6)
  • netstat.exe
  • nslookup.exe corpus 2 (sigma 1, splunk 1)
  • pathping.exe
  • ping.exe corpus 2 (sigma 1, splunk 1)
  • quser.exe corpus 3 (sigma 2, splunk 1)
  • schtasks.exe corpus 23 (sigma 18, splunk 4, elastic 1)
  • sysinfo.exe corpus 2 (sigma 2)
  • tasklist.exe corpus 4 (sigma 3, elastic 1)
  • tracert.exe
  • ver.exe
  • wevtutil.exe corpus 7 (sigma 5, elastic 1, splunk 1)
  • whoami.exe corpus 9 (sigma 9)
  • wmic.exe corpus 61 (sigma 36, splunk 18, elastic 7)
ParentImageends_with
  • \caddy.exe corpus 4 (sigma 4)
  • \httpd.exe corpus 6 (sigma 6)
  • \java.exe corpus 8 (sigma 8)
  • \javaw.exe corpus 7 (sigma 7)
  • \nginx.exe corpus 6 (sigma 6)
  • \php-cgi.exe corpus 6 (sigma 6)
  • \w3wp.exe corpus 12 (sigma 12)
  • \ws_tomcatservice.exe corpus 6 (sigma 6)
ParentImagematch
  • -tomcat- corpus 4 (sigma 4)
  • \tomcat corpus 6 (sigma 6)