Removing Bots & Malware
This guide shows how to find, stop and remove malicious processes such as bots or crypto miners on a compromised Linux or Windows server. It also lists the steps required after cleanup to close the entry point.
Act immediately. After cleanup, change all passwords right away and fix the root cause of the compromise — patch outdated software, replace weak passwords, and review which accounts were affected. The server is considered untrusted until the entry point has been identified and closed.
ss and /proc, kill the process, and remove the malicious directory.Linux Server
Step 1: Check for suspicious connections
Use ss (or the older netstat) to find unusual open connections — watch for non-standard ports (e.g. 6667 / IRC) or processes with a SYN_SENT status masquerading as legitimate services like sshd:
Step 2: Identify the process path
Once you have the Process ID (PID) from the output, check the actual location of the executable in /proc:
If the path points somewhere unexpected — like /usr/local/games/.bot/httpd instead of a real system binary — the process is malicious.
Step 3: Kill the process
Forcefully terminate the process using its PID:
Step 4: Delete the malicious directory
Navigate to the parent directory and recursively delete the malicious folder — this ensures no recovery scripts remain:
Helpful resources for Linux
Windows Server
Step 1: Find suspicious processes
Open Task Manager (Ctrl+Shift+Esc) → Details tab. Look for processes with unusually high CPU or memory usage, random-looking names, or processes running under an unexpected system user.
Step 2: Identify the process path
To get the full file path of a suspicious process, run the following in PowerShell — replace SuspectProcessName with the name from Task Manager:
If the path points to Temp, AppData, or C:\ProgramData, the process is very likely malicious.
Step 3: Terminate the process
Stop the process via PowerShell using either the PID or the process name:
Step 4: Delete the file and run a scan
Delete the executable file identified in Step 2. Then run a full Offline Scan with Microsoft Defender Antivirus to find and isolate all related components — the offline scan runs before Windows boots, so it can catch malware that hides during normal operation.
Helpful resources for Windows
After Cleanup — Required Actions
root / Administrator and any user under which the malicious process was running.usermod -L username and set its shell to /usr/sbin/nologin (usermod -s /usr/sbin/nologin username). On Windows: disable the account in User Management.