Sigma rule: MSSQL XPCmdshell Suspicious Execution

A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-f51925263ab6, updated 2024-06-26T00:00:00.000Z.

Rule

Title
MSSQL XPCmdshell Suspicious Execution
Status
test
Level
high
Author
Nasreddine Bencherchali (Nextron Systems)
Date
2022-07-12
Modified
2024-06-26
File
rules/windows/builtin/application/mssqlserver/win_mssql_xp_cmdshell_audit_log.yml
Commit
ccbb0369507f796db0b0ae6854c8a2be471b9d84

Detects when the MSSQL "xp_cmdshell" stored procedure is used to execute commands

Log source

product
windows
service
application
definition
Requirements: MSSQL audit policy to monitor for "xp_cmdshell" must be enabled in order to receive this event in the application log (Follow this tutorial https://dba.stackexchange.com/questions/103183/is-there-any-way-to-monitor-execution-of-xp-cmdshell-in-sql-server-2012)

Detection

selection:
    Provider_Name|contains: 'MSSQL' # Note: We use contains to account for other third party providers - See https://github.com/SigmaHQ/sigma/issues/4876
    EventID: 33205
    Data|contains|all:
        # You can modify this to include specific commands
        - 'object_name:xp_cmdshell'
        - 'statement:EXEC'
condition: selection

False positives (as the rule lists them)

  • Unknown

Tags

  • attack.execution

References

Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/builtin/application/mssqlserver/win_mssql_xp_cmdshell_audit_log.yml

Sources and licences

  • SigmaHQ

    "MSSQL XPCmdshell Suspicious Execution" by Nasreddine Bencherchali (Nextron Systems) (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/builtin/application/mssqlserver/win_mssql_xp_cmdshell_audit_log.yml.
    Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License

    Detection Rule License (DRL) 1.1

Cite this page

Dragons Eye Ransomware Tracker, "Sigma rule: MSSQL XPCmdshell Suspicious Execution",
entity page, dataset version ref-f51925263ab6, updated 2024-06-26T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/7f103213-a04e-4d59-8261-213dddf22314 (accessed 2026-11-03).
Underlying source: SigmaHQ rule 7f103213-a04e-4d59-8261-213dddf22314, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.

Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.