In the past months we published a white paper exploring the risks that users can encounter when downloading materials from P2P sharing network, such as the Torrent one. We discussed how crooks easily lure their victims to download malware along with the desired content. Recently, our threat monitoring operations pointed us to an interesting file named “Lucio Dalla Discografia Completa”: this file pretends to be a collection of the discography of a famous
For this reason, Cybaze-Yoroi ZLAB dissected this malware threat revealing its hidden virulent nature.
As anticipated, the file downloaded from the BitTorrent network is an executable. A quick recon revealed it actually is an SFX archive containing several other files.
|Brief Description||Coin-miner dropper (SFX archive)|
Table 1: Static Information about the miner dropper
The usage of an archive like SFX allows the attacker to hide the content of the malicious PE and significantly reduce the detection rate. Opening the sample with a common archive manager like WinRAR or 7z, unveil its content.
The archive contains more than a dozen of files. In detail it embeds:
On the right of Figure 1 it is possible to see the SFX configuration file. After the auto-extraction, the first file run is “run.vbs”. Its content is minimal and quickly redirect the execution to a small batch file, “installer.bat” contained in the same folder. Then it runs installer.bat (the filename) with the parameter “0″ (WindowStyle hidden, to avoid hidden windows because it may trigger AntiViruses heuristics) and “true” (WaitOnReturn).
The content of “installer.bat” file is also minimal and points to a more complex text file “007.tmp”, later renamed as “007.bat”. That file weighs over 59 KB and contains more interesting functionalities.
Unlike the previous script, the “007” file performs many operations. The first one is to copy of all files contained in the extraction path directory into “#” subdirectory and to rename some of the just extracted files, suggesting some of the files are dependencies of a more complex chain.
Code Snippet 1: Copy of the files in a subfolder
After that, it generates three different files named “001.tmp”, “32.tmp” and “64.tmp”, later renamed with “.exe” suffix. They are created by mixing up the original files. In particular: “001.tmp” is created combining file “008.tmp”, “009.tmp” and “010.tmp”. The resulting executable have been split in those files, evading AV signatures.
But this composed executable hides another interesting detail. Before merging the file slices, the script replaces part of the PE header: it overrides the “This program cannot be run in DOS mode” string with random chars, generating different files hashes at every infection. This polymorphic techniques implemented directly in bash stage is applied to all the other files chunked and embedded into the original SFX archive.
After that, the script tries to use the just created “Rar.exe” and “7z.exe” files to create new SFX file in other directories belonging to the P2P platforms. This trick is used to spread the attack across the file-sharing communities, to compromise much more victims and to keep the infection alive. An example of this routine is the following:
Code Snippet 2: Example of propagation routine
All these actions are performed for each system drive letter, such as C:, D:, X: and so on. After that, the script looks for the Microsoft Windows OS version from “5.x” to “15.x” and finally executes several specific routines according to the target machine. These routines perform a few basic operations:
Code Snippet 3: Choose of the files to copy whether the target architecture is x86 or x64
At this point, the malicious control passes to the 001.exe file located in the Startup folder.
The 001.exe is actually packed with a known version of the UPX compressor. So, the extraction of the payload is quite straight forward.
|Brief Description||Coin-miner Payload (001.exe) packed with UPX|
Table 2: Generic info about the Miner Loader
|Threat||Miner Launcher Decompressed|
|Brief Description||Coin-miner Payload (001.exe) unpacked|
Table 3: Generic info about the Miner Loader unpacked
Analyzing the decompressed binary, we noticed the malware firstly tries to run the “svchost.exe” binary contained in “%systemdrive%\AppCache\x86”, which likely is the real payload.
|Brief Description||Coin-miner Payload (32.exe) packed with UPX (minerd)|
Table 4: Generic Information of the Coininer compiled in 32 bit (UPX packed)
|Brief Description||Coin-miner Payload (64.exe) packed with UPX (minerd)|
Table 5: Generic Information of the Coininer compiled in 32 bit (UPX unpacked)
The “svchost.exe” placed in the file “%systemdrive%\AppCache\x86” folder actually is one of the two files “32.exe” and “64.exe” previously created. After unpacking routines, the results are the following.
|Brief Description||Coin-miner Payload (32.exe) unpacked (minerd)|
Table 6: Generic Information of the Coininer compiled in 64 bit (UPX packed)
|Brief Description||Coin-miner Payload (64.exe) unpacked(minerd)|
Table 7: Generic Information of the Coininer compiled in 64 bit (UPX packed)
Obviously, these hashes changes at every infection due to the polymorphic technique implemented in the bash stage previously described. The unique purpose of “001.exe” is the execution of “32.exe” or “64.exe” contained in “%systemdrive%\AppCache\x86”, a stratum-based coinminer. Stratum is the de-facto standard protocol used by crypto-miners to connect to mining pools.
Exploring the sample we notice that it actually is “MinerD”, an open-source cryptomining software publicly available on GitHub.
This malware threat reminds us of the hidden risks of downloading material through p2p networks, along with the tricks adopted by the crooks to keep the campaign running in the wild. Indeed, this sample is able to survive across multiple p2p network by propagating to p2p shared folders configured into the victim machine, ensuring a good level of resilience from the attacker point of view. Also, the attackers implemented polymorphic trick directly in batch language, replacing of part of the PE file header to create unique samples on each infection .
A naive or a distracted user can be lured to download infected media contents with the promise to ear his favorite musician, but this action can be compromise the machine of the victim and feed the cyber-criminals behind this campaign. This time, the consequences of such lack of awareness are quite contained, the final payload is actually a crypto-miner and the user may only experience delays or crashes, but what if the payload contains a bot a RAT, or even a ransomware? The consequences could be more serious.
Technical details, including IoCs and Yara Rules, are available in the analysis published
|[adrotate banner=”9″]||[adrotate banner=”12″]|