Detection rules › Sigma

Webshell Hacking Activity Patterns

Status
test
Severity
high
Log source
product windows, category process_creation
Author
Florian Roth (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects certain parent child patterns found in cases in which a web shell is used to perform certain credential dumping or exfiltration activities on a compromised system

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Webshell Hacking Activity Patterns
id: 4ebc877f-4612-45cb-b3a5-8e3834db36c9
status: test
description: |
    Detects certain parent child patterns found in cases in which a web shell is used to perform certain credential dumping or exfiltration activities on a compromised system
references:
    - https://youtu.be/7aemGhaE9ds?t=641
author: Florian Roth (Nextron Systems)
date: 2022-03-17
modified: 2023-11-09
tags:
    - attack.persistence
    - attack.discovery
    - attack.t1505.003
    - attack.t1018
    - attack.t1033
    - attack.t1087
logsource:
    category: process_creation
    product: windows
detection:
   # Webserver
    selection_webserver_image:
        ParentImage|endswith:
            - '\caddy.exe'
            - '\httpd.exe'
            - '\nginx.exe'
            - '\php-cgi.exe'
            - '\w3wp.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'
    # Suspicious child processes
    selection_child_1:
        # Process dumping
        CommandLine|contains|all:
            - 'rundll32'
            - 'comsvcs'
    selection_child_2:
        # Winrar exfil
        CommandLine|contains|all:
            - ' -hp'
            - ' a '
            - ' -m'
    selection_child_3:
        # User add
        CommandLine|contains|all:
            - 'net'
            - ' user '
            - ' /add'
    selection_child_4:
        CommandLine|contains|all:
            - 'net'
            - ' localgroup '
            - ' administrators '
            - '/add'
    selection_child_5:
        Image|endswith:
            # Credential stealing
            - '\ntdsutil.exe'
            # AD recon
            - '\ldifde.exe'
            - '\adfind.exe'
            # Process dumping
            - '\procdump.exe'
            - '\Nanodump.exe'
            # Destruction / ransom groups
            - '\vssadmin.exe'
            - '\fsutil.exe'
    selection_child_6:
        # SUspicious patterns
        CommandLine|contains:
            - ' -decode '  # Used with certutil
            - ' -NoP '  # Often used in malicious PowerShell commands
            - ' -W Hidden '  # Often used in malicious PowerShell commands
            - ' /decode '  # Used with certutil
            - ' /ticket:'  # Rubeus
            - ' sekurlsa'  # Mimikatz
            - '.dmp full'  # Process dumping method apart from procdump
            - '.downloadfile('  # PowerShell download command
            - '.downloadstring('  # PowerShell download command
            - 'FromBase64String' # PowerShell encoded payload
            - 'process call create' # WMIC process creation
            - 'reg save '  # save registry SAM - syskey extraction
            - 'whoami /priv'
    condition: 1 of selection_webserver_* and 1 of selection_child_*
falsepositives:
    - Unlikely
level: high

Stages and Predicates

Stage 0: condition

1 of selection_webserver_* and 1 of selection_child_*

Stage 1: selection_webserver_image

selection_webserver_image:
    ParentImage|endswith:
        - '\caddy.exe'
        - '\httpd.exe'
        - '\nginx.exe'
        - '\php-cgi.exe'
        - '\w3wp.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_child_1

selection_child_1:
    CommandLine|contains|all:
        - 'rundll32'
        - 'comsvcs'

Stage 5: selection_child_2

selection_child_2:
    CommandLine|contains|all:
        - ' -hp'
        - ' a '
        - ' -m'

Stage 6: selection_child_3

selection_child_3:
    CommandLine|contains|all:
        - 'net'
        - ' user '
        - ' /add'

Stage 7: selection_child_4

selection_child_4:
    CommandLine|contains|all:
        - 'net'
        - ' localgroup '
        - ' administrators '
        - '/add'

Stage 8: selection_child_5

selection_child_5:
    Image|endswith:
        - '\ntdsutil.exe'
        - '\ldifde.exe'
        - '\adfind.exe'
        - '\procdump.exe'
        - '\Nanodump.exe'
        - '\vssadmin.exe'
        - '\fsutil.exe'

Stage 9: selection_child_6

selection_child_6:
    CommandLine|contains:
        - ' -decode '
        - ' -NoP '
        - ' -W Hidden '
        - ' /decode '
        - ' /ticket:'
        - ' sekurlsa'
        - '.dmp full'
        - '.downloadfile('
        - '.downloadstring('
        - 'FromBase64String'
        - 'process call create'
        - 'reg save '
        - 'whoami /priv'

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
  • -NoP corpus 3 (sigma 3)
  • -W Hidden corpus 5 (sigma 5)
  • -decode corpus 4 (sigma 4)
  • -hp corpus 4 (sigma 4)
  • -m corpus 3 (sigma 3)
  • /add corpus 4 (sigma 4)
  • /decode corpus 2 (sigma 2)
  • /ticket: corpus 2 (sigma 2)
  • a corpus 4 (sigma 4)
  • administrators corpus 2 (sigma 2)
  • localgroup corpus 2 (sigma 2)
  • sekurlsa
  • user corpus 3 (sigma 3)
  • .dmp full
  • .downloadfile( corpus 8 (sigma 7, chronicle 1)
  • .downloadstring( corpus 8 (sigma 7, chronicle 1)
  • /add corpus 9 (sigma 5, splunk 2, kusto 2)
  • CATALINA_HOME corpus 3 (sigma 3)
  • FromBase64String corpus 12 (sigma 9, splunk 2, elastic 1)
  • catalina.jar corpus 3 (sigma 3)
  • comsvcs corpus 3 (sigma 2, chronicle 1)
  • net corpus 7 (sigma 7)
  • process call create corpus 3 (sigma 3)
  • reg save
  • rundll32 corpus 26 (sigma 23, chronicle 2, kusto 1)
  • whoami /priv
Imageends_with
  • \Nanodump.exe
  • \adfind.exe corpus 2 (sigma 2)
  • \fsutil.exe corpus 5 (sigma 5)
  • \ldifde.exe corpus 4 (sigma 4)
  • \ntdsutil.exe corpus 5 (sigma 5)
  • \procdump.exe corpus 4 (sigma 4)
  • \vssadmin.exe corpus 6 (sigma 6)
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)