We have heard a lot about the WordPress inbound Bruteforce attacks. On checking we can see the inbound attack IP’s may have cpanel installed and are actually generating from some other server which is infected.
Two day before,we got a message from a client of ours saying data center has informed them that server is infected and is generating attacks on other servers. Initially I am not able to get any of the details regarding the attack as no rogue process is running neither scan using gave me any valid clue on this attack .
I was just checking the result of tcpdump to see the what all data is being transferred from the server.
[email protected] ~ # tcpdump -A -i eth0 -s 1500 port not 22
While checking the results I can see something is going on and many wp-login.php entry was going on.
Sample tcpdump Output (changed domain and hostnames)
v.G....pPOST /restaurants/wp-login.php HTTP/1.0^M Host: domain.com^M Content-Type: application/x-www-form-urlencoded^M Content-Length: 30^M ^M log=admin&pwd=minedoruksay2940 06:15:22.056294 IP host5.domain.com > host6.domain.com48202: Flags [P.], seq 2779525802:2779527849, ack 2761432155, win 3216, options [nop,nop,TS val 166530731 ecr 1994475337], length 2047
I tried to stop apache and mysql ,psa, and still some process were running as www-data user and the process was some thing like the below.
www-data 1258 10.8 1.5 18327 1268 ? Ssl Dec10 129:10 /usr/bin/host
I took the lsof result of this command and I got the culprit (account ) responsible for this attack 🙂 Thanks to lsof command to give me correct location and scripts.
Relevant output from lsof command
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME host 20636 username cwd DIR 9,2 4096 60874901 /var/www/vhosts/domain.com/site1/wordpress/wp-content/plugins/subscribe2/extension/readygraph/assets/js host 20636 username rtd DIR 9,2 4096 2 / host 20636 username txt REG 9,2 120240 68160132 /usr/bin/host host 20636 username DEL REG 9,2 60817452 /var/www/vhosts/domain.com/site1/wordpress/wp-content/plugins/subscribe2/extension/readygraph/assets/js/bruteforce.so host 20636 username mem REG 9,2 22928 23855190 /lib/libnss_dns-2.11.3.so host 20636 username mem REG 9,2 51728 23855282 /lib/libnss_files-2.11.3.so host 20636 username mem REG 9,2 12582912 60827148 /var/www/vhosts/domain.com/site1/wordpress/wp-content/plugins/subscribe2/extension/readygraph/assets/js/.frsdfg host 20636 username DEL REG 9,2 60817412 /var/www/vhosts/domain.com/site1/wordpress/wp-content/plugins/subscribe2/extension/readygraph/assets/js/libworker.so
cwd : /var/www/vhosts/domain.com/site1/wordpress/wp-content/plugins/subscribe2/extension/readygraph/assets/js
The above entry from lsof means attack is being generated from this folder and scripts are located in this location.
Above 3 files are the main hack files in which /bruteforce.so was not present in the server at that time . This script was removed soon after the attack in initiated.
To fix this , I have removed the entire “js” folder and then kill all these process. Also asked client to remove the plugin. It will be good if we can remove the host binary (/usr/bin/host) file. If it is there, they can again come back with the attack and can kill the server reputation within few hours.