Detection rules › Sigma
SQL server sqlcmd utility abuse for privilege escalation
Detects scenarios where an attacker uses sqlcmd utility to escalate privileges or introduce weaknesses.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Persistence | T1505.001 Server Software Component: SQL Stored Procedures |
Event coverage
| Provider | Event | Title |
|---|---|---|
| Sysmon | Event ID 1 | Process creation |
| Security-Auditing | Event ID 4688 | A new process has been created. |
Rule body yaml
title: SQL server sqlcmd utility abuse for privilege escalation
description: Detects scenarios where an attacker uses sqlcmd utility to escalate privileges or introduce weaknesses.
references:
- https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack/tree/master/TA0003-Persistence/T1505.001-SQL%20Stored%20Procedures
- https://blog.netspi.com/when-databases-attack-hacking-with-the-osql-utility/
- http://travisaltman.com/pen-test-and-hack-microsoft-sql-server-mssql/
- https://thedfirreport.com/2021/12/13/diavol-ransomware/
- https://twitter.com/TheDFIRReport/status/1498804631090208777?t=TKMbiJINaLoJqQqXIF5mCA&s=09
- https://blog.talosintelligence.com/breaking-the-silence-recent-truebot-activity/
- https://unit42.paloaltonetworks.com/espionage-campaign-targets-south-asian-entities/
tags:
- attack.persistence
- attack.t1505.001
-
author: mdecrevoisier
status: experimental
logsource:
product: windows
category: process_creation
detection:
selection:
NewProcessName|endswith:
- '\sqlcmd.exe' # used in recent SQL Server versions
- '\osql.exe' # used in old SQL server version
CommandLine|contains: # specify the database\instance'
- /S
- -S
CommandLine|contains: # runs a query and immediately exists
- /Q
- -Q
condition: selection
falsepositives:
- Master database restore procedure
- Maintenance operation
- Legitim SA account password recovery
level: high
Stages and Predicates
Stage 0: condition
selectionStage 1: selection
selection:
NewProcessName|endswith:
- '\sqlcmd.exe'
- '\osql.exe'
CommandLine|contains:
- /S
- -S
CommandLine|contains:
- /Q
- -Q
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.
| Field | Kind | Values |
|---|---|---|
CommandLine | match |
|
NewProcessName | ends_with |
|