Since the middle of July, McAfee has observed new updates of the Emotet, a Trojan that was first discovered in 2014. This malware harvests banking credentials. Early variants used Outlook contact harvesting to spread via malicious spam.
The latest variants act as loaders and use several mechanisms to spread over the network and send spam email. They also use techniques to bypass antimalware products and avoid detection. Initial infection vectors are emails containing a link to download a malicious Office document. Once a system is infected, Emotet collects the computer name and running process information, which are encrypted and sent to a control server via a Post request.
Emotet updates itself with the latest version from the server, and attempts to download additional malware, such as Dridex (banking malware). The banking malware is designed to harvest banking credentials by installing a malicious component into the web browser. It also uses evasion techniques such as “atom bombing” to inject malicious code.
The following illustration shows how Emotet works:
The initial infection vector of Emotet is a malicious Office document containing an obfuscated macro that runs a PowerShell script to download the payload.
Additional information can be found here:
Details of our analyzed sample.
The malware uses several mechanisms to stay persistent and undetected. It unpacks itself directly into memory and drops malicious files in the system. Emotet acts as a loader and can enable several modules. During our analysis, we saw the following:
- Worm module via brute-force attack to spread over the network.
- Dropping malware.
- Sending spam with compromised emails to spread around the world.
- Updating main file to bypass antimalware signatures.
These modules are enabled by the control server and allow the attackers to perform malicious actions on infected machines.
The malware contains an icon that can be identified on infected machines. We saw several updates to the icon during the campaign:
Emotet malware icons.
Once the malware is running, it is unpacked several times into memory. This process allows the malware to bypass antimalware detection before runtime. The following screenshot shows the unpacking process.
Unpacking at runtime.
The malware changes its name to avoid detection once it has infected a system. In this case the malware used certtask.exe. Each infected machine could have a different name.
Emotet uses several mechanisms to stay persistent, allowing it to run after each reboot. It also creates a service to run the malicious file. Early variants created scheduled tasks.
Emotet employs a control server to communicate with infected machines and send the stolen credentials:
Control server connection.
The malware updates itself by sending a Post request and showing a 404 error from the server to fool analysts.
A Post request.
The control server address changed throughout the campaign.
We found that Emotet uses a worm module to spread on the network. It brute-force attacks an account to break the password and copy itself on a network share.
A brute-force attack. The malware attempts to connect to specific users.
Emotet spreads by email from compromised accounts. The attackers can remotely activate the spam module, which dynamically uses the credentials to send email:
The sample arrives packed and runs several processes to unpack its content. By tracking the VirtualAlloc API, we can follow the dump of an unpacked version into memory.
Dumping the unpacked executable into memory.
The dumped executable is a file that runs without an import address table to avoid static analysis. All the functions are resolved dynamically when the sample runs.
Dynamic API resolution.
The sample creates a mutex as an infection marker to detect if the machine is already infected.
Creating a mutex to match the filename emo.bin.
The malware uses a different mutex, generated with the filename during execution, to avoid any possible vaccine. The mutex is always the same if the filename does not change.
The following example shows a different mutex name with a different filename:
Creating a mutex to match the filename emoo2.exe.
To detect any debugging, Emotet employs the undocumented function NtSetInformationProcess:
Emotet creates a suspended process to unpack. If the debugger is detected, the malware terminates the suspended process; otherwise it continues the execution and infects the system.
Emotet has evolved to take advantage of several evasions, persistence, and spreading techniques. It also downloads additional malware to harvest banking credentials and take other actions.
The spreading techniques on the local network seem to have come from lessons learned from the WannaCry and (Not)Petya outbreaks to increase the rates of infection. We can expect to see more weaponized lateral movements in the future.
The author thanks @tehsyntx and @_remixed for their help with this analysis.
Indicators of Compromise
- %appdata%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
- <Randomname>.LNK. file in the startup folder
- HKLM\System\CurrentControlSet\Services “RandomNumbers”
- HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run “RandomNames” with value c:\users\admin\appdata\roaming\<random>\<legitfile>.exe
- 81.62.54 Canada
- 106.1.205 Germany
- 254.40.5 Germany
- 23.244.244 Germany
- 160.15.198 Germany
- 160.178.17 Germany
- 188.40.189 Germany
- 86.91.232 Germany
- 134.140.21 France
- 196.73.150 France
- 121.121.72 France
- 187.103.156 France
- 210.206.25 France
- 79.132.214 United Kingdom
- 110.224.51 Italy
- 166.175.18 Netherlands
- 138.200.249 Netherlands
- 191.233.221 Poland
- 150.19.63 Thailand
- 21.183.63 United States
- 81.128.131 United States
- 230.145.224 United States
- 21.113.151 United States
- 3.75.246 United States
- 218.156.113 United States
- 31.0.39 United States
- 253.164.249 United States
- 81.212.79 United States
- 83.223.34 United States
- 243.126.142 United States
- 210.245.164 United States
- 43.168.206 United States
The post Emotet Trojan Acts as Loader, Spreads Automatically appeared first on McAfee Blogs.