password
status
date
icon
category
tags
slug
summary
0x00 背景
简单分析后发现是 2020 年出现的Systemd Miner挖矿木马的变种。分析及清理脚本如下
0x01 脚本分析
使用 doh 解析域名, tor 代理下载恶意文件。。。。好高级
流程 解析域名获取tor代理ip ---> 查找目标主机可读写路径 ---> 通过tor代理在服务器上下载恶意文件、使用 tor2web 访问 ---> 在目标主机上开启crontab计划任务 ---> 执行恶意文件并删除---> 判断恶意进程是否启动,未启动则再次拉起
代理下载
直连下载
0x02 恶意文件分析
用 ida 分析一波
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1968d6d7-5418-4d85-a1de-dec3b074c30e%2FUntitled.png?table=block&id=f8de4171-15f3-4ed4-8d40-b460130386ec)
不好静态调试,采用动态调试
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F32717aed-787a-4a6d-bfb8-2a0a05ce7790%2FUntitled.png?table=block&id=a033aea4-ff6f-4fd2-9875-f1c9dd988240)
/tmp/.X11-unix/01 — 守护进程 pid
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F2ec616ce-58fe-4220-8a96-81247b422599%2FUntitled.png?table=block&id=b966e2ae-bdf7-47bf-8f4d-64d6a48b24f3)
执行以下脚本
1.清理常见安全产品的计划任务
2.屏蔽、干掉其他挖矿程序
下载 cmd 模块
下载 cpu 模块
请求 bot 模块
对/tmp/.X11-unix进行修改权限锁定
0x03 模块分析
3.1 cpu
挖矿模块
输出主进程 pid 到 /tmp/.X11-unix/11
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F8550a876-e4bf-49a8-a56e-c3315ab69170%2FUntitled.png?table=block&id=73be3e9f-b19b-4956-b833-64fb449582ce)
通过jsonrpc方式登录到矿池
使用xmrig挖矿程序在136.243.90.99矿池挖门罗币
3.2 BOT
用于提交服务器各种信息(whoami、uname -m、uname -n、ip a)
3.3 CMD
随机下载 5 个程序中的一个,执行完后删除
1 redis 内网横向模块
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ffffe9b0a-df57-45a9-8c88-46d3d331fffe%2FUntitled.png?table=block&id=ac4b5af5-d25e-4fa5-bcb7-f3132b3992a7)
2 postgresql 内网横向模块
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F21421569-3dec-4f60-a147-63e1f9d95a66%2FUntitled.png?table=block&id=b00d08c1-596a-4395-a445-eb8b94747838)
3 hadoop yarn漏洞 8088端口 内网横向模块
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fccee2016-6c03-4457-85f0-186ce3bdeb97%2FUntitled.png?table=block&id=94e263a3-aa41-4158-9957-9cac87852019)
4 Consul RCE 8500端口 内网横向模块
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3159ac50-6532-4799-ab1a-29c4361fbff0%2FUntitled.png?table=block&id=baa60412-1e33-483a-85bf-8a142c668222)
5 SSH 横向脚本
下载 sshd 文件后发现里面有三个文件
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F35839229-eaba-421f-948f-05f93aa6432a%2FUntitled.png?table=block&id=0e9c59e5-b402-464f-b8e3-9ecf98fca264)
0x04 清理脚本
0x05 后记
Feb 24, 2022 又碰到这个挖矿了,以前让我脱不掉的 upx 魔改壳现在已经乱脱了😂
- 作者:fatekey
- 链接:https://blog.fatekey.icu/article/systemdminer
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。