T1505.001: SQL Stored Procedures
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).
Adversaries may craft malicious stored procedures that can provide a persistence mechanism in SQL database servers.[1][2] To execute operating system commands through SQL syntax the adversary may have to enable additional functionality, such as xp_cmdshell for MSSQL Server.[1][2][3]
Microsoft SQL Server can enable common language runtime (CLR) integration. With CLR integration enabled, application developers can write stored procedures using any .NET framework language (e.g. VB .NET, C#, etc.).[4] Adversaries may craft or modify CLR assemblies that are linked to stored procedures since these CLR assemblies can be made to execute arbitrary commands.[5]
Analyst context for executives and security teams
SQL stored procedures matter because they turn a database feature into a potential persistence point. If an attacker can create or modify database-side code, that code may survive restarts and be invoked later through normal database activity or events. For leaders, the risk is not just database compromise; it is durable access inside systems that often support critical applications and business processes.
Executive priority
Prioritize this where SQL database servers support high-value applications, regulated data, or operational technology dependencies. The key business question is whether database administrative privileges, stored procedure changes, CLR integration, and operating-system command execution features are governed, logged, and reviewable. This technique is also relevant to audit readiness because privileged database changes and server-side code execution should have accountable approval and monitoring evidence.
Technical view
This is a persistence sub-technique under Server Software Component for Windows and Linux environments. SOC, detection engineering, and IR teams should validate visibility into creation, modification, and execution of stored procedures, especially procedures configured to run on database startup or tied to defined events. For Microsoft SQL Server environments, validate monitoring around enabling or use of features referenced by ATT&CK such as xp_cmdshell and CLR integration, and review CLR assemblies linked to stored procedures. Because MITRE does not provide official detection text for this object, detection content should be validated against local database audit configuration and the related DET0181 detection strategy where available.
Likely telemetry
- Database audit logs for stored procedure creation, alteration, deletion, and execution
- Database server configuration changes, including enablement of command-execution or runtime integration features such as xp_cmdshell or CLR integration where applicable
- Privileged database account activity and role membership changes
- Startup or event-driven database procedure execution records
- Operating system process creation events from database server processes where collected
Detection direction
- Baseline legitimate stored procedures and alert on unexpected creation or modification, especially by privileged or rarely used accounts.
- Correlate database-side procedure activity with operating system process execution from database service contexts when that telemetry is available.
- Tune for administrative false positives from deployments, maintenance jobs, and application releases by integrating change windows and approved database code repositories.
- Review database startup procedures or event-triggered execution paths because persistence may not look like interactive attacker activity.
- Validate whether logging captures both successful and failed attempts to enable risky database functionality; absence of audit data is a major blind spot.
Mitigation priorities
- Apply privileged account management: restrict who can create, alter, or execute high-risk stored procedures and enforce least privilege for database administrators and service accounts.
- Require accountable change control and auditing for stored procedure and database extension changes, especially on production servers.
- Where code signing is applicable to database extensions or assemblies, use it to help ensure only trusted code is allowed.
- Review and limit optional database functionality that permits operating-system command execution or external runtime integration unless there is a justified business need.
- Regularly audit stored procedures, CLR assemblies, startup procedures, and privileged database roles for unauthorized or unexplained changes.
Analyst notes and limits
The supplied ATT&CK relationships connect this behavior to persistence, the parent technique Server Software Component, mitigations for Privileged Account Management, Code Signing, and Audit, and references to Stuxnet and the 2016 Ukraine Electric Power Attack. Those relationships make the technique relevant to cyber-physical and critical infrastructure risk discussions, but local exposure depends on whether affected database platforms and features exist in the environment.
MITRE provides no official detection text for this object in the supplied fields. The description includes Microsoft SQL Server-specific examples such as xp_cmdshell and CLR integration, but the listed platforms are Windows and Linux; defenders should map guidance to their actual database products and audit capabilities. No claim is made here about active exploitation, customer exposure, or guaranteed detection coverage.
SQL Stored Procedures
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).
Adversaries may craft malicious stored procedures that can provide a persistence mechanism in SQL database servers.[1][2] To execute operating system commands through SQL syntax the adversary may have to enable additional functionality, such as xp_cmdshell for MSSQL Server.[1][2][3]
Microsoft SQL Server can enable common language runtime (CLR) integration. With CLR integration enabled, application developers can write stored procedures using any .NET framework language (e.g. VB .NET, C#, etc.).[4] Adversaries may craft or modify CLR assemblies that are linked to stored procedures since these CLR assemblies can be made to execute arbitrary commands.[5]
How security teams should use this page
Treat this object as behavior context, not an attribution claim. Validate the related groups, software, data sources, and mitigations against official ATT&CK relationships and your own telemetry before making control-coverage decisions.
Related techniques
This mirrors the MITRE pattern of making group, software, campaign, and technique relationships scannable. Relationship notes come from mirrored ATT&CK relationship text when available.
| Domain | ID | Name | Relationship / procedure |
|---|---|---|---|
| Enterprise | T1505 | Server Software Component | This object subtechnique of Server Software Component. |
Groups, software, and campaigns
S0603: Stuxnet
Stuxnet was the first publicly reported malware to specifically target industrial control systems devices. Stuxnet is a large and complex malware that utilized multiple behaviors, including numerous zero-day vulnerabilities, a sophisticated Windows rootkit, and network infection routines.[1][2][3][4] Stuxnet was discovered in 2010, with some components being used as early as November 2008.[1]
C0025: 2016 Ukraine Electric Power Attack
2016 Ukraine Electric Power Attack was a Sandworm Team campaign during which they used Industroyer malware to target and disrupt distribution substations within the Ukrainian power grid. This campaign was the second major public attack conducted against Ukraine by Sandworm Team.[1][2]
All related ATT&CK context
Mitigation direction
Object version and sync metadata
The fields below describe the current mirrored snapshot. When Glexia retains multiple ATT&CK source imports, you can open the table to compare the same object across releases (hashes and MITRE timestamps). For MITRE’s own release notes and roadmap, see ATT&CK resources — Updates .
Imported snapshots across ATT&CK releases (1)
| Release | Bundle imported | Object version | Modified | Status | Raw hash |
|---|---|---|---|---|---|
| 19.1 | 1.1 | Current bundle | 1ffea9e2194d… |
Mirrored ATT&CK source object
The raw object is retained through the mirrored ATT&CK source bundle and object hash. The raw endpoint returns the exact object from the mirrored bundle when available.
External references and citations
MITRE external references are preserved separately from Glexia analysis so citations remain traceable to their original source records.
-
[1]
NetSPI Startup Stored Procedures
Sutherland, S. (2016, March 7). Maintaining Persistence via SQL Server – Part 1: Startup Stored Procedures. Retrieved September 12, 2024.
Open source URL -
[2]
Kaspersky MSSQL Aug 2019
Plakhov, A., Sitchikhin, D. (2019, August 22). Agent 1433: remote attack on Microsoft SQL Server. Retrieved September 4, 2019.
Open source URL -
[3]
Microsoft xp_cmdshell 2017
Microsoft. (2017, March 15). xp_cmdshell (Transact-SQL). Retrieved September 9, 2019.
Open source URL -
[4]
Microsoft CLR Integration 2017
Microsoft. (2017, June 19). Common Language Runtime Integration. Retrieved July 8, 2019.
Open source URL -
[5]
NetSPI SQL Server CLR
Sutherland, S. (2017, July 13). Attacking SQL Server CLR Assemblies. Retrieved September 12, 2024.
Open source URL -
[6]
mitre-attack T1505.001Open source URL
Source: MITRE ATT&CK®. © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. MITRE ATT&CK and ATT&CK are registered trademarks of The MITRE Corporation. Glexia is not affiliated with or endorsed by MITRE.