Server was injected with mining program

Mining programs are a type of program that invade the computing resources of the host and conduct virtual currency mining. The host often sees high CPU usage and other related malicious programs. Meanwhile, it kills some other services, such as Nginx.

Find the high CPU usage processes

top

observes an abnormal process, "kswapd0" (not the default 'kswapd0' process). Make a note of the PID.

 

Find the physical file path of the process

ls -l /proc/<PID>/exe

 

Kill the process

kill <PID>

 

Verify if the process is killed

top

pgrep -x <process_name>
# pgrep -x kswapd0

 

If the process is automatically restarted immediately, temporarily turn off swap, and then turn it on after fixing the problem.

# turn off
swapoff -a

# turn on
swapon -a

 

Remove the physical file (fetched by 'ls -l /proc/<PID>/exe')

rm -rf <physical_folder_or_file>

 

Check for any other folders or files that have copies.

find / -name <process_name>

Remove the malicious folder/files as well.

 

Check Cron Jobs

crontab -l

 

Remove bad cron jobs by editing the content

crontab -e

 

Reset 'root' password and reboot server

passwd root

 

创建时间:11/21/2023 10:39:26 AM 修改时间:11/21/2023 11:28:23 AM