MSSQL SPProcoption Set

Detects when the a stored procedure is set or cleared for automatic execution in MSSQL. A stored procedure that is set to automatic execution runs every time an instance of SQL Server is started

Sigma rule (View on GitHub)

 1title: MSSQL SPProcoption Set
 2id: b3d57a5c-c92e-4b48-9a79-5f124b7cf964
 3status: test
 4description: Detects when the a stored procedure is set or cleared for automatic execution in MSSQL. A stored procedure that is set to automatic execution runs every time an instance of SQL Server is started
 5references:
 6    - https://www.netspi.com/blog/technical/network-penetration-testing/sql-server-persistence-part-1-startup-stored-procedures/
 7    - https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-procoption-transact-sql?view=sql-server-ver16
 8author: Nasreddine Bencherchali (Nextron Systems)
 9date: 2022-07-13
10modified: 2024-06-26
11tags:
12    - attack.persistence
13logsource:
14    product: windows
15    service: application
16    definition: 'Requirements: MSSQL audit policy to monitor for "sp_procoption" must be enabled in order to receive this event in the application log'
17    # warning: The 'data' field used in the detection section is the container for the event data as a whole. You may have to adapt the rule for your backend accordingly
18detection:
19    selection:
20        Provider_Name|contains: 'MSSQL' # Note: We use contains to account for other third party providers - See https://github.com/SigmaHQ/sigma/issues/4876
21        EventID: 33205
22        Data|contains|all:
23            - 'object_name:sp_procoption'
24            - 'statement:EXEC'
25    condition: selection
26falsepositives:
27    - Legitimate use of the feature by administrators (rare)
28level: high

References

Related rules

to-top