This week, the SonicWall Capture Labs threat research team investigated a sample of GhostRAT malware. This highly infectious file is built to be persistent and thorough, with many anti-analysis, anti-AV, anti-VM, and evasion techniques. Upon infection, the entire system is scraped for data, all points of input are hooked to be recorded, and it has multiple methods of loading itself or one of its dropped modules into memory.
The initial sample is a 73MB file which is detected as being packed with 7-Zip, as well as having suspicious markers: the time stamp is fifteen years old, and any file with 7-Zip should not have an installer, archive, and overlay with the same data.
Figure 1: Initial sample detection
However, attempting to unzip the file gives an error that the checksum data is bad, meaning the only way a normal user would be able to see the file contents is by launching the program.
Figure 2: Error received when attempting to manually unzip
Dynamic analysis is necessary as the sample is substantially larger than the average malware file, as well as the excessive amount of anti-analysis, anti-VM and anti-debug capabilities. When the sample is run through a debloat program, the size drops to 184kb but generates new errors, despite running similar system checks when launched.
During runtime, the following actions are taken:
Parent sample drops files in the following locations:
Update.exe runs commands to set persistence
The “monitor.bat” file checks for the running process and, if not found, loads a copy of the binary into memory.
Figure 3: Contents of “monitor.bat”
Figure 4: Updated.ps1 script contents
In addition to the PowerShell script, a .lnk, or shortcut file, is created and dropped. This is actually a Shell32 command that will create a new executable but only if the required system path exists.
Figures 5 and 6: Attempting to open or edit the shortcut will result in one of these messages
Looking at the file in a hex editor reveals some of the commands.
Figure 7: Decoded ASCII text from the .lnk file
The OS is queried for hardware and software versions, locale, installed languages, and system time. There are also multiple checks for virtualized environments with Xen or Qemu hosts, as well as debugging tools; GhostRAT will look for software breakpoints, use time comparisons, IsDebuggerPresent, IsProcessorFeaturePresent, and debug message output. A mutex is created in the following format:
The parent sample, along with a dropped file named ‘Update.exe’, will then perform the following actions while reaching out to two IP addresses acting as C2 servers:
- Acs.exe: Atheros Configuration Server
- ashDisp.exe: Avast Antivirus
- AYAgent.aye: ALYac EDR
- Avcenter.exe: Avira Antivirus
- Avgwdsvc.exe: AVG Security
- Avp.exe: Avast Security
- Cfp.exe: Comodo Firewall Pro
- K7TSecurity.exe: K7 Total Security
- KSafeTray.exe: Kingsoft PC Doctor
- Kxetray.exe: Kingsoft Internet Security
- Mcshield.exe: McAfee Antivirus
- QUHLPSVC.EXE: Quick Heal Total Security
- RavMonD.exe: Rising Internet Security (Beijing)
- Rtvscan.exe: Symantec Endpoint Protection
- TMBMSRV.exe: TrendMicro Security
- Vsserv.exe: BitDefender Total Security
- HKEY_CURRENT_USER\Console\IpStats
In short, this will enumerate every file, process, clipboard data, registry entry, and drive. Using privilege escalation, it will shutdown or hinder antivirus products and create multiple points of persistence. All input is recorded, as well as screen activity, to the point that “Update.exe” can change the wallpaper on a victim’s system. Data is encoded via XOR and RC4 to be exfiltrated to designated C2 servers.
To ensure SonicWall customers are prepared for any exploitation that may occur due to this malware, the following signatures have been released:
Share This Article
An Article By
An Article By
Security News
Security News