Skip to content

SQL Stored Procedures

SQL stored procedures present a significant vector for maintaining persistence and deepening control within compromised database systems. During the Deepening Control phase, after an attacker has gained initial access to a database server, they can leverage stored procedures to establish more entrenched access mechanisms that survive system reboots and password changes. Attackers typically create or modify stored procedures with embedded malicious code that executes with the permissions of the procedure owner or invoker, often running with elevated database privileges. These procedures can be configured to trigger on specific database events, system startups, or periodic schedules, making them difficult to detect amidst legitimate stored procedure activities. The malicious stored procedures may perform various functions such as creating backdoor accounts, extracting sensitive data, modifying security configurations, or establishing covert communication channels with command and control infrastructure. The persistence afforded by stored procedures is particularly dangerous as they operate at the heart of database operations, can leverage the database engine's built-in scheduling capabilities, and may continue executing malicious actions long after the initial compromise has been remediated.