清除wnTKYg挖矿木马的全过程

今天下午, 同事登录nginx服务器, 发现一个进程占用CPU100%: 搜索得知是一个挖矿木马, 通过redis漏洞来植入的。 检查crontab: 发现一个redis进程: 查看操作日志: 查看/root/.ssh/authorized_keys, 发现多了个不明key:

  初步判明, 由于187和186上以前同事测ABTestingGateway时启动了两个redis, 但是没有设redis的密码, 因为redis是root帐户启动的, 所以通过redis把ssh public key写入了root的authorized_keys, 从而运行了一个cron程序, 之前一直没发现是因为内存和CPU使用率都在正常范围内(CPU使用率60%) 按照网上方法杀之: 删除不明key 杀掉进程并清理crontab和运行程序

增加防火墙策略:

配置csf防火墙

启动lfd时报错: [root@jump1-iuap-hb2-ali system]# systemctl restart csf [root@jump1-iuap-hb2-ali system]# systemctl restart lfd Job for lfd.service failed because a configured resource limit was exceeded. See “systemctl status lfd.service” and “journalctl -xe” for details. 解决: 编辑/etc/csf/csf.conf, 将下面改为0: PT_USERMEM = “0″ 配置csf 为openvpn: 参考: https://www.grumpyland.com/blog/238/making-csf-work-with-openvpn/ 创建文件:         vim /etc/csf/csfpre.sh 添加如下内容: iptables -A FORWARD -m Read more…