Detection rules › Elastic
Suspicious Execution via SQL PowerShell
Detects attempts to execute suspicious powershell commands using the Microsoft SQL Powershell Helper Tools.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule body
[rule]
description = "Detects attempts to execute suspicious powershell commands using the Microsoft SQL Powershell Helper Tools."
id = "d111e88f-c5d2-41b4-b294-1f9cfea93b6c"
license = "Elastic License v2"
name = "Suspicious Execution via SQL PowerShell"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/OtherMSBinaries/Sqltoolsps/"]
version = "1.0.4"
query = '''
process where event.action == "start" and
process.name : ("SQLToolsPS.exe", "sqlps.exe") and
process.args : ("-e", "-enc", "-ep", "-encoded", "*;iex", "*start-process*", "*WebClient*",
"*DownloadFile*", "*DownloadString*", "*BitsTransfer*", "*Reflection.Assembly*")
'''
min_endpoint_version = "7.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "7.16.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.name : ("SQLToolsPS.exe", "sqlps.exe") and
process.args : ("-e", "-enc", "-ep", "-encoded", "*;iex", "*start-process*", "*WebClient*",
"*DownloadFile*", "*DownloadString*", "*BitsTransfer*", "*Reflection.Assembly*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_name" kind:wildcard |