Google Project Zero accuses Linux of sloppy kernel patching Watch Now

Malware targeting Linux users may not be as widespread as the strains targeting the Windows ecosystem, but Linux malware is becoming just as complex and multi-functional as time passes by.

The latest example of this trend is a new trojan discovered this month by Russian antivirus maker Dr.Web. This new malware strain doesn't have a distinctive name, yet, being only tracked under its generic detection name of Linux.BtcMine.174.

But despite the generic name, the trojan is a little bit more complex than most Linux malware, mainly because of the plethora of malicious features it includes.

The trojan itself is a giant shell script of over 1,000 lines of code. This script is the first file executed on an infected Linux system. The first thing this script does is to find a folder on disk to which it has write permissions so it can copy itself and later use to download other modules.

Once the trojan has a foothold on the system it uses one of two privilege escalation exploits CVE-2016-5195 (also known as Dirty COW) and CVE-2013-2094 to get root permissions and have full access to the OS.

The trojan then sets itself up as a local daemon, and even downloads the nohup utility to achieve this operation if the utility is not already present.

After the trojan has a firm grasp on the infected host, it then moves on to executing its primary function for which it was designed for, which is cryptocurrency mining. The trojan first scans and terminates the processes of several rival cryptocurrency-mining malware families, and then downloads and starts its own Monero-mining operation.

It also downloads and runs another malware, known as the Bill.Gates trojan, a known DDoS malware strain, but which also comes with many backdoor-like functions.

However, Linux.BtcMine.174 is not done. The trojan will also look for process names associated with Linux-based antivirus solutions, and kill their execution. Dr.Web researchers say they've seen the trojan stop antivirus processes that have names such as safedog, aegis, yunsuo, clamd, avast, avgd, cmdavd, cmdmgd, drweb-configd, drweb-spider-kmod, esets, xmirrord.

But even after setting itself up as a daemon, getting root permissions via known exploits, and installing the Bill.Gates malware with its backdoor capabilities, the trojan's operators still aren't happy with their level of access to infected hosts.

According to Dr.Web, the trojan also adds itself as an autorun entry to files like /etc/rc.local, /etc/rc.d/..., and /etc/cron.hourly; and then downloads and runs a rootkit.

This rootkit component has even more intrusive features, experts said, such as "the ability to steal user-entered passwords for the su command and to hide files in the file system, network connections, and running processes."

That's quite the impressive list of malicious functions, but Linux.BtcMine.174 is still not done. The trojan will also run a function that collects information about all the remote servers the infected host has connected via SSH and will try to connect to those machines as well, to spread itself to even more systems.

This SSH self-spreading mechanism is believed to be the trojan's main distribution channel. Because the trojan also relies on stealing valid SSH credentials, this means that even if some Linux sysadmins are careful to properly secure their servers' SSH connections and only allow a selected number of hosts to connect, they might not be able to prevent an infection if one of those selected hosts has been infected without his knowledge.

Dr.Web has uploaded SHA1 file hashes for the trojan's various components on GitHub, in case some sysadmins want to scan their systems for the presence of this relatively new threat. More on Dr.Web's analysis of Linux.BtcMine.174 here.

More security coverage: