Cryptomining botnet exploiting exposed Docker API 

The botnet exploits exposed Docker API to drop and execute a shell-script as the initial payload:

sha256 of cronb.sh: 7d7d0b4353401225e8da8424a7e1c5edaa091b256bdd48b7dcb158befca0b205

Attack Summary:

  • disables AliBaba (Aliyun) Cloud monitor, SELINUX and AppArmor
  • clears cron jobs
  • kills competing malware and existing miners on victim host
  • looks for SSH keys and AWS creds (Team-TNT code reuse)
  • uses Diamorphine and LD_PRELOAD rootkits
  • disables “shutdown reboot poweroff telinit” commands to prevent shutdown
  • adds SSH keys for persistence
  • downloads ELF bins with .jpg extension
  • drops and runs Tsunami botnet binary for C2
  • drops and runs tmate agent used by TeamTNT

Main functions:

1) Disables firewalls and security/monitoring services:

  • ufw and iptables firewalls
  • Alibaba cloud monitor service (Aliyun)
  • SELINUX
  • AppArmor

2) Kills competing malware and existing miners on victim host

Code: https://pastebin.com/AfseqXMq

3) Clears and locks cronjobs

4) Searches for stored SSH keys and AWS credentials

5) Downloads Tsunami botnet ELF binary with .jpg extension (apa.jpg) and runs it named as bioset, potentially an attempt to disguise the malware as a kernel thread.

Apa.jpg analysis:
VirusTotal: https://www.virustotal.com/gui/file/6574b93062974e287a65798dca6f6efd2bc8f8e376baa6efa69ddfc719acf8d9
Sandbox: https://elfdigest.com/report/6574b93062974e287a65798dca6f6efd2bc8f8e376baa6efa69ddfc719acf8d9
C2 domain: hbase.zzhreceive.top

6) Builds and deploys Diamorphine Rootkit on victim host

  • The Diamorphine source code archive is base64 encoded and stored as a string in the bash-script 
  • Installs necessary packages and Linux kernel headers to compile the kernel module

7) Deploys LD_PRELOAD rootkit

  • Downloads a TAR archive with .so shared object libraries
  • Deploys the .so libraries in /usr/local/lib and adds them to ld.so.preload

8) Locks down the system

9) Adds account and SSH key as a backdoor for persistence

10) Deploys and configures XMR Miner
Wallet: 43Xbgtym2GZWBk87XiYbCpTKGPBTxYZZWi44SWrkqqvzPZV6Pfmjv3UHR6FDwvPgePJyv9N5PepeajfmKp1X71EW7jx4Tpz

12) Downloads and executes TeamTNT agent ‘tmate’

tmate binary analysis:
Virustotal: https://www.virustotal.com/gui/file/d2fff992e40ce18ff81b9a92fa1cb93a56fb5a82c1cc428204552d8dfa1bc04f
Sandbox analysis: https://elfdigest.com/report/d2fff992e40ce18ff81b9a92fa1cb93a56fb5a82c1cc428204552d8dfa1bc04f
C2 domain: ssh.tmate.io

IoCs:

SHA256File
6574b93062974e287a65798dca6f6efd2bc8f8e376baa6efa69ddfc719acf8d9apa.jpg
eca42c42f0909cf4e6df6bf8de35ab93ef6a3dd10d0d5e556721ec1871a9990ccf.jpg
7d7d0b4353401225e8da8424a7e1c5edaa091b256bdd48b7dcb158befca0b205cronb.sh
cbb37344fdf2429306d4f608237def14465f5667080f6ee43c732d8d42fa7e5bcronis.sh
3bab64440c6afc81dbd2c956070ad1196e7b19d5a10ff0615fd9ec06df29a775dia.tar.gz
3f15276876988717846ca687aca6efde12774b09c4eb56cb560054a491230ac3father.jpg
c0d98c16cfcc255c5719827a3cc5e3ffb526d48b1b911ca10ad4495e935c4e54hide.jpg
bcda32c949a98b2f781c12dd2c6ab84ff3965ec432b2ffdeb58a9fc4234bbf45midp.jpg
d2fff992e40ce18ff81b9a92fa1cb93a56fb5a82c1cc428204552d8dfa1bc04ftmate
9cf853a49247acca754c25d21af5eb2c8ae079c658b89e752e7888aa64ba21e9xmrig-6.10.0-linux-static-x64.tar.gz

All files have been uploaded to bazaar.abuse.ch and VirusTotal.

URLs:
hxxp://bbq.zzhreceive.top/midp.jpg
hxxp://oracle.zzhreceive.top/b2f628/cf.jpg
hxxp://oracle.zzhreceive.top/b2f628fff19fda999999999/cronis.sh
hxxp://oracle.zzhreceive.top/b2f628/cronb.sh
hxxp://oracle.zzhreceive.top/b/apa.jpg
hxxp://oracle.zzhreceive.top/hide/hide.jpg
hxxp://bbq.zzhreceive.top/tmate 
hxxp://oracle.zzhreceive.top/b2f628/b.sh

C2:
ssh.tmate.io
hbase.zzhreceive.top

Monero wallet: 43Xbgtym2GZWBk87XiYbCpTKGPBTxYZZWi44SWrkqqvzPZV6Pfmjv3UHR6FDwvPgePJyv9N5PepeajfmKp1X71EW7jx4Tpz