This rule detects adversaries deploying a SQL-based hacking tool named sql.exe to establish persistence or execute malicious queries within the environment. Proactive hunting for this behavior in Azure Sentinel is critical because such tools are frequently used by threat actors to exfiltrate sensitive database information and maintain covert access, often evading standard signature-based defenses due to their legitimate appearance.
rule Hacktools_CN_Burst_sql {
meta:
description = "Disclosed hacktool set - file sql.exe"
author = "Florian Roth"
date = "17.11.14"
score = 60
hash = "d5139b865e99b7a276af7ae11b14096adb928245"
strings:
$s0 = "s.exe %s %s %s %s %d /save" fullword ascii
$s2 = "s.exe start error...%d" fullword ascii
$s4 = "EXEC sp_addextendedproc xp_cmdshell,'xplog70.dll'" fullword ascii
$s7 = "EXEC master..xp_cmdshell 'wscript.exe cc.js'" fullword ascii
$s10 = "Result.txt" fullword ascii
$s11 = "Usage:sql.exe [options]" fullword ascii
$s17 = "%s root %s %d error" fullword ascii
$s18 = "Pass.txt" fullword ascii
$s20 = "SELECT sillyr_at_gmail_dot_com INTO DUMPFILE '%s\\\\sillyr_x.so' FROM sillyr_x" fullword ascii
condition:
6 of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 9 string patterns in its detection logic.
Here are 5 specific false positive scenarios for the Disclosed hacktool set - file sql.exe detection rule, including actionable filters and exclusions:
Scenario: Scheduled Database Maintenance via SQL Server Agent
SQLServerAgent) frequently executes maintenance plans (backups, index rebuilding) that spawn sql.exe processes to run T-SQL scripts or connect to the engine. In an enterprise environment, these are often scheduled nightly and trigger the detection due to the process name matching the hacktool signature.ParentProcessName is sqlagent.exe or SQLServerAgent. Additionally, filter by the specific file path: C:\Program Files\Microsoft SQL Server\MSSQL*\MSSQL\Binn\sql.exe.Scenario: Deployment Automation with PowerShell DSC or Ansible
sql.exe directly from a known deployment server to execute migration scripts (sqlcmd) during change windows.HostGroup: DevOps-Servers) where the AccountName is a known service account like svc-deploy-sql.Scenario: Third-Party Backup Solutions Executing Native SQL Commands
sql.exe as