A new cryptojacking campaign targeting Docker Engine APIs has been uncovered, with threat actors using Docker Swarm’s orchestration features to control compromised systems. The attackers focus on exposed Docker API endpoints that are left unauthenticated, leveraging tools like masscan and ZGrab to scan for vulnerable Docker, Kubernetes, and SSH services. Once a vulnerable endpoint is discovered, the attackers deploy an Alpine container and execute a shell script (init.sh) that installs a cryptocurrency miner (XMRig) and enables the execution of additional payloads. These payloads allow for lateral movement to other systems within the network, increasing the reach of the attack.
The attackers use a set of shell scripts to enable lateral movement and spread their malware to other containers and servers within the network. These scripts, such as spread_docker_local.sh and spread_ssh.sh, are responsible for scanning additional systems for vulnerabilities and attempting to install malware on them. The spread_ssh.sh script, in particular, compromises SSH servers by adding an SSH key and a new user to enable persistent access for the attackers. The malware also exfiltrates valuable information, such as credentials from Amazon Web Services (AWS) and Google Cloud, further strengthening the attackers’ foothold in the network.
In addition to exploiting Docker’s vulnerabilities, the campaign uses various techniques to avoid detection. For example, the attackers use the libprocesshider rootkit to hide the miner process from system monitoring tools, making it harder for security teams to identify the cryptojacking activity. Other scripts like ar.sh modify iptables rules and clear logs to avoid detection, while the script TDGINIT.sh manipulates Docker Swarm by forcing compromised systems to join a new Swarm under the control of the attackers. This manipulation allows for coordinated control of multiple Docker instances, increasing the efficiency and scale of the cryptojacking operation.
Though the exact threat group behind the campaign remains unknown, the tactics used bear similarities to the known group TeamTNT, which is infamous for using Docker and Kubernetes for cryptojacking at scale. The campaign highlights the ongoing risk posed by unauthenticated Docker APIs and the importance of securing these endpoints. Researchers stress that even small attack surfaces, like exposed API endpoints, can lead to widespread exploitation when attackers can quickly propagate their malware across a network. The attack underscores the need for better security practices, particularly in cloud environments, to prevent these types of large-scale, automated cryptojacking campaigns.
Reference: