Crooks continue to abuse exposed Docker APIs for Cryptojacking
29.10.2019 securityaffairs
Cryptocurrency  Cyber

Cybercriminals continue to abuse unprotected Docker APIs to create new containers used for cryptojacking, Trend Micro warns.
Crooks continue to abuse unprotected Docker APIs to create new containers used for cryptojacking.

Earlier this year Sysdig and Aqua Security researchers started observing cyber attacks targeting Kubernets and Docker instances aimed at mining Monero cryptocurrency.

A container is a package that contains an application and all the dependencies that are required to its execution. Each Docker container runs on Docker Engine along with other containers. Experts pointed out that a Docker Engine is not properly secured could be exposed to remote attack through Docker Engine API.

Miscreants can abuse Docker Engine API to deploy containers they have created with the specific intent of mining cryptocurrencies.

docker api abuse-3

Experts from Trend Micro have recently observed threat actors scanning for exposed Docker Engine APIs (port 2375 and 2376), attackers aimed at abusing them to deploy containers that used for cryptojacking.

“We recently observed cases of abuse of the systems running misconfigured Docker Engine-Community with Docker application program interface (API) ports exposed. We also noticed that the malicious activities were focused on scanning for open ports 2375/TCP and 2376/TCP, which are used by the Docker engine daemon (dockerd).” reads the analysis published by Trend Micro.

“The intrusion attempts to deploy a cryptocurrency-mining malware (detected by Trend Micro as Coinminer.SH.MALXMR.ATNE) on the misconfigured systems.”

The researchers observed that hackers often create Docker containers through exposed API ports and run the following commands on compromised installs:
Install a wget package using system package manager.
Use wget to download an auto-deployment script.
Convert the script from DOS to Unix format (the script line endings are often in DOS format).
Set the executable permissions for the script.
Run the script (auto.sh).
The auto.sh script deploys a Monero miner and also a port scanning software, which will scan for other vulnerable Docker Engine installs.

Experts have seen attackers scanning all networks from the host with a scan rate of 50,000 packets per second for open ports 2375 and 2376 and save the result into local.txt file.

The attackers conduct lateral movement by infecting or abusing other hosts identified in previous reconnaissance scans.

Experts provided recommendations to secure Docker Engine installs, below best practices provided by Trend Micro:

Harden the security posture. The Center for Internet Security (CIS) has a reference that can help system administrators and security teams establish a benchmark to secure their Docker engine.
Ensure that container images are authenticated, signed, and from a trusted registry (i.e., Docker Trusted Registry). Employing automated image scanning tools helps improve development cycles.
Enforce the principle of least privilege. For instance, restrict access to the daemon and encrypt the communication protocols it uses to connect to the network. Docker has guidelines on how to protect the daemon socket.
Properly configure how much resources containers are allowed to use (control groups and namespaces).
Enable Docker’s built-in security features to help defend against threats. Docker has several guidelines on how to securely configure Docker-based applications.