Currently viewing ATT&CK v8.2 which was live between October 27, 2020 and April 28, 2021. Learn more about the versioning system or see the live site.

Server Software Component: SQL Stored Procedures

ID Name
T1505.001 SQL Stored Procedures
T1505.002 Transport Agent
T1505.003 Web Shell

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]

ID: T1505.001
Sub-technique of:  T1505
Tactic: Persistence
Platforms: Linux, Windows
Permissions Required: Administrator, SYSTEM, root
Data Sources: Application logs
Contributors: Carlos Borges, @huntingneo, CIP; Kaspersky; Lucas da Silva Pereira, @vulcanunsec, CIP
Version: 1.0
Created: 12 December 2019
Last Modified: 25 March 2020

Mitigations

Mitigation Description
Audit

Regularly check component software on critical services that adversaries may target for persistence to verify the integrity of the systems and identify if unexpected changes have been made.

Code Signing

Ensure all application component binaries are signed by the correct application developers.

Privileged Account Management

Do not allow administrator accounts that have permissions to add component software on these services to be used for day-to-day operations that may expose them to potential adversaries on unprivileged systems.

Detection

On a MSSQL Server, consider monitoring for xp_cmdshell usage.[1] Consider enabling audit features that can log malicious startup activities.

References