Server Software Component: SQL Stored Procedures T1505.001

Tactic: Persistence

Adversaries may abuse SQL stored procedures to establish persistent access to systems. SQL Stored Procedures are code that can be saved and reused so that database users do not waste time rewriting frequently used SQL queries. Stored procedures can be invoked via SQL statements to the database using the procedure name or via defined events (e.g. when a SQL server application is started/restarted).

Events covered

11 catalog events are tagged with this technique by at least one rule.

Authoring guide

Patterns shared across the 18 rules above: which fields they filter on, what specific values they look for, and what they exclude. The catalog normalizes field names across vendors so Sigma's Image, Elastic's process.name, and Splunk's process_name collapse into one row. Each rule contributes at most once per row.

Fields filtered most (23 distinct)

The fields most rules look at when detecting this technique. The How column shows the operators authors use (eq, wildcard, regex_match, match) and how often each appears. Sample values are concrete examples to start from, not an exhaustive list.

FieldRulesHowSample values
EventID7eq 715457, 1, 17135, 4688, 8128
Channel5eq 5, in 5
eventtype5eq 5
parent_process_name4eq 2, match 2(?i)sqlservr\.exe, sqlservr.exe
process_name4match 2, eq 1, in 1(?i)\x5c(bash|bitsadmin|cmd|net|netstat|nltest|mshta|ping..., bitsadmin.exe, certutil.exe, cmd.exe, powershell.exe
CommandLine3contains 2, is_not_null 1, match 1-m, -q, /m, /q, MSSQL$
Image3ends_with 3\foxitpdfreader.exe, \net.exe, \net1.exe, \osql.exe, \sqlcmd.exe
EventData2contains 2<data>clr enabled</data><data>0</data><data>1</data>, <data>remote admin connections</data><data>0</data><data>1</data>
OriginalFileName2eq 2, in 1cmd.exe, bitsadmin.exe, certutil.exe, powershell.exe, powershell_ise.exe
config_name2eq 1, in 1Ad Hoc Distributed Queries, Ole Automation Procedures, clr enabled, xp_cmdshell
event.type2eq 2start
EventType1eq 1ProcessCreated
GlobalPrevalence1lt 1250
GrandParentImage1eq 1sqlservr.exe
ParentCommandLine1starts_with 1\"cmd.exe\" /c

Top indicator values (67 distinct)

Specific (field, operator, value) combinations the rules check for, ranked by how many rules under this technique use each one. The Corpus reach column counts how many rules across the entire catalog (any technique) check the same combination. High numbers point to widely-used indicators that are likely noisy on their own; combine them with another condition for useful signal. Blank means the combination is specific to rules under this technique. Click a value to expand the rules under this technique that use it.

FieldKindValueRules (here)Corpus reach
EventIDeq
15457
33
EventIDeq
1
1237
EventIDeq
17135
1
EventIDeq
4688
1313
EventIDeq
8128
1
OriginalFileNameeq
cmd.exe
265
OriginalFileNameeq
powershell.exe
1120
OriginalFileNameeq
powershell_ise.exe
151
OriginalFileNameeq
pwsh.dll
1112
event.typeeq
start
2606
parent_process_nameeq
sqlservr.exe
22
parent_process_namematch
(?i)sqlservr\.exe
22
process_namematch
(?i)\x5c(bash|bitsadmin|cmd|net|netstat|nltest|mshta|ping|powershell|pwsh|reg...
22
CommandLinecontains
-m
12
CommandLinecontains
-q
19
CommandLinecontains
/m
1
CommandLinecontains
/q
18
CommandLinecontains
start
113
CommandLinematch
MSSQL$
1
EventDatacontains
<data>clr enabled</data><data>0</data><data>1</data>
1
EventDatacontains
<data>remote admin connections</data><data>0</data><data>1</data>
1
EventTypeeq
ProcessCreated
110
GlobalPrevalencelt
250
14
GrandParentImageeq
sqlservr.exe
1
Imageends_with
\foxitpdfreader.exe
1
Imageends_with
\net.exe
149
Imageends_with
\net1.exe
147
Imageends_with
\osql.exe
1
Imageends_with
\sqlcmd.exe
15
OriginalFileNamein
bitsadmin.exe
13

Exclusions (29 distinct)

Field/operator/value combinations excluded by rules under this technique (top-level not() clauses), sorted by how many rules exclude each. These are the false-positive paths the community has learned to filter out. A new rule that ignores the high-count entries here will likely fire on the same noisy paths. Click a value to expand the rules under this technique that exclude it.

FieldKindValueRules excluding
CommandLinestarts_with
/c echo
1
Imageeq
?:\windows\system32\conhost.exe
1
Imageeq
?:\windows\system32\werfault.exe
1
Imageeq
?:\windows\system32\wermgr.exe
1
ProfileAvailabilityeq
Error
1
parent_process_nameeq
forfiles.exe
1
parent_process_nameeq
sqlservr.exe
1
process.code_signature.subject_nameeq
Microsoft Corporation
1
process.code_signature.subject_nameeq
Microsoft Windows
1
process.code_signature.trustedeq
true
1
process_nameeq
bcp.exe
1
process_nameeq
cmd.exe
1
process_nameeq
databasemail.exe
1
process_nameeq
dtexec.exe
1
process_nameeq
fdhost.exe
1

Rules under this technique

Every rule in the catalog tagged with this technique, grouped by vendor. Click a rule title for its full predicates, exclusions, and indicators.

Platform (all)
Domain (all)

Sigma 7 rules

Elastic 2 rules

Splunk 8 rules

Kusto 1 rule