The infection chain of this malware campaign | Image: FortiGuard Labs
At a Glance
| Malware Family | T-SQL malware chain (UPX-packed Go scanner dllhost.exe, .NET brute-forcer CSQL.exe/dwm.exe, Secs.exe FTP loader, XMRig miner, and Gh0st RAT) |
| Threat Actor | Unattributed operator (suspected Chinese-speaking threat actor based on Tencent QQ data theft module and 78-process security scanner list) |
| Target / Victims | Internet-facing Microsoft SQL Server instances on TCP port 1433 (one U.S. Xeon server confirmed in telemetry; total victim count undisclosed) |
| Delivery Vector | Naabu /16 subnet port scanning followed by 500-thread SQL credential brute-forcing and remote T-SQL script execution |
| Key Capabilities | xp_cmdshell and Ole Automation Procedures abuse, FTP payload staging, Monero CPU mining, keylogging, Tencent QQ file theft, and 30+ RAT commands |
TL;DR
FortiGuard Labs uncovered an active T-SQL malware campaign targeting internet-facing Microsoft SQL Server systems. The attackers use a Go binary embedding the open-source Naabu port scanner and a 2,700-password dictionary to breach exposed databases on TCP port 1433. Once authenticated, the MS SQL Server T-SQL malware runs remote database scripts that install an XMRig cryptocurrency miner and a Gh0st RAT backdoor.
Delivery and Attribution
The operation begins on an already infected Windows machine running a 64-bit Go executable named dllhost.exe, which is packed with UPX versions 3.9 through 5.21. Upon launch, the binary downloads eight supporting files into the local temporary folder: 2018.sql, dwm.exe, go.bat, go.vbs, out.bat, user.txt, pass.txt, and sqlcmd.exe. To stay active on the scanning host, it creates a scheduled task. This task runs every 30 minutes under a name mimicking a Microsoft Edge update.
Next, the scanner sends an HTTP GET request to its command server to receive a target IP address. It then converts that address into a /16 CIDR subnet. Afterward, it uses the embedded Naabu v2 library to send TCP SYN probes to port 1433. Whenever a server completes the handshake, the scanner logs the open address inside Result.txt. Confirmed attribution to a named group does not exist. However, suspected attribution points to a financially motivated, Chinese-speaking operator. This is because the final Gh0st RAT payload specifically steals local Tencent QQ user data and checks for Chinese security processes such as 360tray.exe. While FortiGuard Labs did not release a total victim count, captured registration traffic showed at least one compromised Intel Xeon server in the United States.
Infection Chain
After the port scan finishes, cscript.exe runs go.vbs, which calls go.bat to check Result.txt for open servers. When matches appear, the batch file launches dwm.exe, a .NET utility with the internal assembly name CSQL.exe. Using up to 500 concurrent threads, this tool brute-forces accounts like sa and admin. It works against a dictionary of more than 2,700 preset passwords.
T-SQL Execution and Loader Drop
When a login succeeds, a second instance of dwm.exe connects to the victim database and runs the batches inside 2018.sql. According to the FortiGuard Labs research report, “T-SQL is Microsoft SQL Server’s SQL extension used to query databases, manage database objects, and execute procedural logic. The malware abuses it to run malicious commands remotely on the compromised server.” Specifically, the script turns on xp_cmdshell and Ole Automation Procedures. One batch downloads down.exe into the C:\Users\Public folder and renames it Google.exe or payload.exe. Then it registers a daily scheduled task named Microsoft_UPDATES. Another batch uses ADODB.Stream to write a hex-encoded binary from a @DATA variable directly to C:\Users\Public\Secs.exe and the Windows Startup folder. Finally, it runs the binary via WScript.Shell.
Command-and-Control and Data-Exfiltration Behavior
Once active on the database host, the Secs.exe loader registers a daily scheduled task disguised as a Microsoft Edge update and sends an HTTP POST request containing the victim’s public IP, country, OS build, CPU model, RAM size, username, and hostname. Next, the loader calls the Windows API FtpGetFileW to pull secondary payloads from an attacker-controlled FTP server into the temporary directory.
Monero Mining and Gh0st RAT Control
The first downloaded payload, disguised as MicrosoftEdgeUpdate.exe and packed with Themida and a custom LZSS wrapper, is an XMRig miner. It hijacks the SQL Server’s CPU to mine Monero using the rx/0 algorithm across Kryptex and Nanopool servers. The miner reports its hash rate back to the operator via HTTP GET requests.
The second FTP payload, named winlogon.exe and also packed with Themida, is a Gh0st RAT variant. It establishes persistence across three locations: the HKLM Run registry key, a Windows service, and a 30-minute scheduled task. As researcher Xiaopeng Zhang noted, “”winlogon.exe” is a Gh0st RAT that provides keylogging, screen capture, file management, a remote shell, and more than 30 control commands for remotely controlling the compromised MS SQL servers.” In addition to wiping Windows event logs and scanning against a 78-entry security process list, the RAT exfiltrates files from local Tencent QQ directories.
Defense and Detection Guidance
This MS SQL Server T-SQL malware campaign relies entirely on internet-exposed port 1433 interfaces and weak administrator passwords. Database administrators should restrict TCP port 1433 access at the perimeter firewall, enforce complex passwords on the sa account, and disable Windows authentication fallback where unneeded. Furthermore, defenders should keep xp_cmdshell and Ole Automation Procedures disabled unless strictly required. They should also audit Windows Task Scheduler for rogue Microsoft_UPDATES or fake Edge update tasks. In addition, defenders should monitor the C:\Users\Public directory for unexpected executables like Secs.exe or Google.exe.
Support Our Threat Intelligence
Find our threat intelligence and malware analysis helpful? Support our work today and unlock a 100% ad-free reading experience!