Detection rules › Sigma

SQL Client Tools PowerShell Session Detection

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Agro (@agro_sev) oscd.communitly
Source
github.com/SigmaHQ/sigma

This rule detects execution of a PowerShell code through the sqltoolsps.exe utility, which is included in the standard set of utilities supplied with the Microsoft SQL Server Management studio. Script blocks are not logged in this case, so this utility helps to bypass protection mechanisms based on the analysis of these logs.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: SQL Client Tools PowerShell Session Detection
id: a746c9b8-a2fb-4ee5-a428-92bee9e99060
status: test
description: |
  This rule detects execution of a PowerShell code through the sqltoolsps.exe utility, which is included in the standard set of utilities supplied with the Microsoft SQL Server Management studio.
  Script blocks are not logged in this case, so this utility helps to bypass protection mechanisms based on the analysis of these logs.
references:
    - https://github.com/LOLBAS-Project/LOLBAS/blob/8283d8d91552213ded165fd36deb6cb9534cb443/yml/OtherMSBinaries/Sqltoolsps.yml
    - https://twitter.com/pabraeken/status/993298228840992768
author: 'Agro (@agro_sev) oscd.communitly'
date: 2020-10-13
modified: 2022-02-25
tags:
    - attack.execution
    - attack.stealth
    - attack.t1059.001
    - attack.t1127
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        - Image|endswith: '\sqltoolsps.exe'
        - ParentImage|endswith: '\sqltoolsps.exe'
        - OriginalFileName: '\sqltoolsps.exe'
    filter:
        ParentImage|endswith: '\smss.exe'
    condition: selection and not filter
falsepositives:
    - Direct PS command execution through SQLToolsPS.exe is uncommon, childprocess sqltoolsps.exe spawned by smss.exe is a legitimate action.
level: medium

Stages and Predicates

Stage 0: condition

selection and not filter

Stage 1: selection

selection:
    - Image|endswith: '\sqltoolsps.exe'
    - ParentImage|endswith: '\sqltoolsps.exe'
    - OriginalFileName: '\sqltoolsps.exe'

Stage 2: not filter

filter:
    ParentImage|endswith: '\smss.exe'

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
ParentImageends_with\smss.exe

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
Imageends_with
  • \sqltoolsps.exe
OriginalFileNameeq
  • \sqltoolsps.exe
ParentImageends_with
  • \sqltoolsps.exe