Detection rules › Sigma

Windows Shell/Scripting Processes Spawning Suspicious Programs

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

Detects suspicious child processes of a Windows shell and scripting processes such as wscript, rundll32, powershell, mshta...etc.

Known false positives

  • Administrative scripts
  • Microsoft SCCM

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Windows Shell/Scripting Processes Spawning Suspicious Programs
id: 3a6586ad-127a-4d3b-a677-1e6eacdf8fde
status: test
description: Detects suspicious child processes of a Windows shell and scripting processes such as wscript, rundll32, powershell, mshta...etc.
references:
    - https://mgreen27.github.io/posts/2018/04/02/DownloadCradle.html
author: Florian Roth (Nextron Systems), Tim Shelton
date: 2018-04-06
modified: 2023-05-23
tags:
    - attack.execution
    - attack.stealth
    - attack.t1059.005
    - attack.t1059.001
    - attack.t1218
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        ParentImage|endswith:
            - '\mshta.exe'
            - '\powershell.exe'
            - '\pwsh.exe'
            # - '\cmd.exe'  # too many false positives
            - '\rundll32.exe'
            - '\cscript.exe'
            - '\wscript.exe'
            - '\wmiprvse.exe'
            - '\regsvr32.exe'
        Image|endswith:
            - '\schtasks.exe'
            - '\nslookup.exe'
            - '\certutil.exe'
            - '\bitsadmin.exe'
            - '\mshta.exe'
    filter_ccmcache:
        CurrentDirectory|contains: '\ccmcache\'
    filter_amazon:
        ParentCommandLine|contains:
            # FP - Amazon Workspaces
            - '\Program Files\Amazon\WorkSpacesConfig\Scripts\setup-scheduledtask.ps1'
            - '\Program Files\Amazon\WorkSpacesConfig\Scripts\set-selfhealing.ps1'
            - '\Program Files\Amazon\WorkSpacesConfig\Scripts\check-workspacehealth.ps1'
            - '\nessus_' # Tenable/Nessus VA Scanner
    filter_nessus:
        CommandLine|contains: '\nessus_' # Tenable/Nessus VA Scanner
    filter_sccm_install:
        ParentImage|endswith: '\mshta.exe'
        Image|endswith: '\mshta.exe'
        ParentCommandLine|contains|all:
            - 'C:\MEM_Configmgr_'
            - '\splash.hta'
            - '{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}'
        CommandLine|contains|all:
            - 'C:\MEM_Configmgr_'
            - '\SMSSETUP\BIN\'
            - '\autorun.hta'
            - '{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}'
    condition: selection and not 1 of filter_*
falsepositives:
    - Administrative scripts
    - Microsoft SCCM
level: high

Stages and Predicates

Stage 0: condition

selection and not 1 of filter_*

Stage 1: selection

selection:
    ParentImage|endswith:
        - '\mshta.exe'
        - '\powershell.exe'
        - '\pwsh.exe'
        - '\rundll32.exe'
        - '\cscript.exe'
        - '\wscript.exe'
        - '\wmiprvse.exe'
        - '\regsvr32.exe'
    Image|endswith:
        - '\schtasks.exe'
        - '\nslookup.exe'
        - '\certutil.exe'
        - '\bitsadmin.exe'
        - '\mshta.exe'

Stage 2: not filter_*

filter_ccmcache:
    CurrentDirectory|contains: '\ccmcache\'
filter_amazon:
    ParentCommandLine|contains:
        - '\Program Files\Amazon\WorkSpacesConfig\Scripts\setup-scheduledtask.ps1'
        - '\Program Files\Amazon\WorkSpacesConfig\Scripts\set-selfhealing.ps1'
        - '\Program Files\Amazon\WorkSpacesConfig\Scripts\check-workspacehealth.ps1'
        - '\nessus_'
filter_nessus:
    CommandLine|contains: '\nessus_'
filter_sccm_install:
    ParentImage|endswith: '\mshta.exe'
    Image|endswith: '\mshta.exe'
    ParentCommandLine|contains|all:
        - 'C:\MEM_Configmgr_'
        - '\splash.hta'
        - '{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}'
    CommandLine|contains|all:
        - 'C:\MEM_Configmgr_'
        - '\SMSSETUP\BIN\'
        - '\autorun.hta'
        - '{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}'

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
CommandLinematchC:\MEM_Configmgr_excludes:CommandLine field:"CommandLine" value:"C:\MEM_Configmgr_"
CommandLinematch\SMSSETUP\BIN\excludes:CommandLine field:"CommandLine" value:"\SMSSETUP\BIN\"
CommandLinematch\autorun.htaexcludes:CommandLine field:"CommandLine" value:"\autorun.hta"
CommandLinematch{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}excludes:CommandLine field:"CommandLine" value:"{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}"
Imageends_with\mshta.exeexcludes:Image field:"Image" value:"\mshta.exe"
ParentCommandLinematchC:\MEM_Configmgr_excludes:ParentCommandLine field:"ParentCommandLine" value:"C:\MEM_Configmgr_"
ParentCommandLinematch\splash.htaexcludes:ParentCommandLine field:"ParentCommandLine" value:"\splash.hta"
ParentCommandLinematch{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}excludes:ParentCommandLine field:"ParentCommandLine" value:"{1E460BD7-F1C3-4B2E-88BF-4E770A288AF5}"
ParentImageends_with\mshta.exeexcludes:ParentImage field:"ParentImage" value:"\mshta.exe"
CommandLinematch\nessus_excludes:CommandLine field:"CommandLine" value:"\nessus_"
CurrentDirectorymatch\ccmcache\excludes:CurrentDirectory field:"CurrentDirectory" value:"\ccmcache\"
ParentCommandLinematch\Program Files\Amazon\WorkSpacesConfig\Scripts\check-workspacehealth.ps1excludes:ParentCommandLine field:"ParentCommandLine" value:"\Program Files\Amazon\WorkSpacesConfig\Scripts\check-workspacehealth.ps1"
ParentCommandLinematch\Program Files\Amazon\WorkSpacesConfig\Scripts\set-selfhealing.ps1excludes:ParentCommandLine field:"ParentCommandLine" value:"\Program Files\Amazon\WorkSpacesConfig\Scripts\set-selfhealing.ps1"
ParentCommandLinematch\Program Files\Amazon\WorkSpacesConfig\Scripts\setup-scheduledtask.ps1excludes:ParentCommandLine field:"ParentCommandLine" value:"\Program Files\Amazon\WorkSpacesConfig\Scripts\setup-scheduledtask.ps1"
ParentCommandLinematch\nessus_excludes:ParentCommandLine field:"ParentCommandLine" value:"\nessus_"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Imageends_with
  • \bitsadmin.exe corpus 29 (sigma 29)
  • \certutil.exe corpus 44 (sigma 43, kusto 1)
  • \mshta.exe corpus 66 (sigma 66)
  • \nslookup.exe corpus 5 (sigma 5)
  • \schtasks.exe corpus 55 (sigma 55)
field:"Image" kind:ends_with
ParentImageends_with
  • \cscript.exe corpus 17 (sigma 17)
  • \mshta.exe corpus 13 (sigma 13)
  • \powershell.exe corpus 24 (sigma 24)
  • \pwsh.exe corpus 21 (sigma 21)
  • \regsvr32.exe corpus 11 (sigma 11)
  • \rundll32.exe corpus 15 (sigma 15)
  • \wmiprvse.exe corpus 8 (sigma 8)
  • \wscript.exe corpus 19 (sigma 19)
field:"ParentImage" kind:ends_with