Detection rules › Sigma

Suspicious Service DACL Modification Via Set-Service Cmdlet

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

Detects suspicious DACL modifications via the "Set-Service" cmdlet using the "SecurityDescriptorSddl" flag (Only available with PowerShell 7) that can be used to hide services or make them unstopable

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Suspicious Service DACL Modification Via Set-Service Cmdlet
id: a95b9b42-1308-4735-a1af-abb1c5e6f5ac
related:
    - id: 99cf1e02-00fb-4c0d-8375-563f978dfd37
      type: derived
status: test
description: Detects suspicious DACL modifications via the "Set-Service" cmdlet using the "SecurityDescriptorSddl" flag (Only available with PowerShell 7) that can be used to hide services or make them unstopable
references:
    - https://www.sans.org/blog/red-team-tactics-hiding-windows-services/
    - https://learn.microsoft.com/pt-br/windows/win32/secauthz/sid-strings
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-10-18
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.t1543.003
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\pwsh.exe'
        - OriginalFileName: 'pwsh.dll'
    selection_sddl_flag:
        CommandLine|contains:
            - '-SecurityDescriptorSddl '
            - '-sd '
    selection_set_service:
        CommandLine|contains|all:
            - 'Set-Service '
            - 'D;;'
        CommandLine|contains:
            - ';;;IU'
            - ';;;SU'
            - ';;;BA'
            - ';;;SY'
            - ';;;WD'
    condition: all of selection_*
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

selection_img:
    - Image|endswith: '\pwsh.exe'
    - OriginalFileName: 'pwsh.dll'

Stage 2: selection_sddl_flag

selection_sddl_flag:
    CommandLine|contains:
        - '-SecurityDescriptorSddl '
        - '-sd '

Stage 3: selection_set_service

selection_set_service:
    CommandLine|contains|all:
        - 'Set-Service '
        - 'D;;'
    CommandLine|contains:
        - ';;;IU'
        - ';;;SU'
        - ';;;BA'
        - ';;;SY'
        - ';;;WD'

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
  • -SecurityDescriptorSddl corpus 2 (sigma 2)
  • -sd corpus 2 (sigma 2)
  • ;;;BA
  • ;;;IU
  • ;;;SU
  • ;;;SY
  • ;;;WD
  • D;;
  • Set-Service corpus 2 (sigma 2)
Imageends_with
  • \pwsh.exe corpus 168 (sigma 168)
OriginalFileNameeq
  • pwsh.dll corpus 112 (sigma 79, splunk 30, elastic 3)