Hack Forums
[MRT-X Academy] Malware Removal Guide for Linux - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Whitehat β€’ Blue Team β€’ Defensive Security (https://hackforums.net/forumdisplay.php?fid=448)
+---- Forum: Malware, Rat, and Virus Removal (https://hackforums.net/forumdisplay.php?fid=110)
+---- Thread: [MRT-X Academy] Malware Removal Guide for Linux (/showthread.php?tid=6294765)



[MRT-X Academy] Malware Removal Guide for Linux - Tha Sneak - Mar 20, 2025

[Image: Ao15uxN.gif]


🐧 Malware Removal Guide for Linux 🐧


[Image: h9AAT39.gif]


⚠️ Can Linux Get Malware?

While Linux is more secure by design than other operating systems, it is not immune to malware.
Threats include:

βœ” Rootkits
βœ” Trojans disguised as .sh scripts or packages
βœ” Crypto miners
βœ” Malicious repositories
βœ” Backdoored software

πŸ’‘ Tip: Malware on Linux often targets servers, misconfigured systems, or users running as root unnecessarily.

[Image: h9AAT39.gif]


πŸ”Ή Step 1: Check for Suspicious Processes

Use terminal commands to view running processes:

Code
ps aux --sort=-%cpu
top
htop

βœ” Look for unknown processes using excessive CPU, memory, or network.

πŸ’‘ Tip: Install htop using your package manager for an interactive view:
Code
sudo apt install htop

[Image: h9AAT39.gif]


πŸ”Ή Step 2: Scan with ClamAV or RKhunter

Install and run open-source antivirus tools:

βœ… ClamAV – Virus scanner
Code
sudo apt update
sudo apt install clamav
sudo freshclam
sudo clamscan -r /

βœ… RKhunter – Rootkit scanner
Code
sudo apt install rkhunter
sudo rkhunter --update
sudo rkhunter --check

πŸ’‘ Tip: For CentOS/RHEL/Fedora, use yum or dnf instead of apt.

[Image: h9AAT39.gif]


πŸ”Ή Step 3: Check Cron Jobs & Startup Scripts

Check for suspicious scheduled tasks or auto-starting malware:

Code
crontab -l
sudo ls -la /etc/cron*
sudo ls -la ~/.config/autostart/

βœ” Delete unknown entries carefully.

πŸ’‘ Tip: Malicious cron jobs may download payloads or run miners silently.

[Image: h9AAT39.gif]


πŸ”Ή Step 4: Review Installed Packages

Check for unfamiliar or malicious packages:

Code
dpkg -l  # For Debian/Ubuntu
rpm -qa  # For RedHat/CentOS

βœ” Remove suspicious packages:
Code
sudo apt remove [package]

πŸ’‘ Tip: Always install software from trusted repositories. Avoid unknown PPAs or external .deb/.rpm files.

[Image: h9AAT39.gif]


πŸ”Ή Step 5: Monitor Network Activity

Use tools to spot suspicious network connections:

Code
netstat -tulnp
ss -tuln
lsof -i

βœ” Look for unfamiliar IPs or services bound to unusual ports.

πŸ’‘ Tip: Install nethogs or iftop to monitor per-process bandwidth usage.

[Image: h9AAT39.gif]


πŸ”Ή Step 6: Analyze Bash History & Aliases

Check for malware launched through terminal:

Code
cat ~/.bash_history
alias

βœ” Look for:
- Scripts you didn’t run
- Hidden curl/wget commands
- Aliases masking common commands (e.g., ls, cd, sudo)

πŸ’‘ Tip: Some malware modifies .bashrc or .profile β€” inspect them if unsure.

[Image: h9AAT39.gif]


πŸ”Ή Step 7: Scan for Malicious Files

Run a full disk scan with ClamAV:

Code
sudo clamscan -r --bell -i /

This command will:
- Scan recursively (-r)
- Ring the bell on detection (--bell)
- Show infected files only (-i)

πŸ’‘ Tip: You can scan just your home folder for faster results:
Code
clamscan -r ~/

[Image: h9AAT39.gif]


πŸ”Ή Step 8: Clean or Reinstall Affected Systems

If your system is heavily infected:

βœ” Backup important files.
βœ” Wipe and reinstall a clean Linux distro.
βœ” Avoid restoring binaries or config files unless verified safe.

πŸ’‘ Tip: Use checksum tools (sha256sum) to verify ISO integrity before reinstalling.

[Image: h9AAT39.gif]


βœ… Tips to Stay Protected on Linux

βœ” Avoid logging in as root for regular tasks.
βœ” Use a firewall (e.g., ufw) to block unnecessary ports.
βœ” Keep your system updated:
Code
sudo apt update && sudo apt upgrade

βœ” Don’t install software from untrusted sources.
βœ” Monitor system logs with journalctl or /var/log/syslog.

πŸ”’ Linux is secure, but only if you practice good hygiene! πŸ”’



RE: [MRT-X Academy] Malware Removal Guide for Linux - Bastille - Mar 21, 2025

Nice check list, thanks for the thread

+1 for Linux hardening, I think we can rely on CIS check lists https://www.cisecurity.org/benchmark


RE: [MRT-X Academy] Malware Removal Guide for Linux - Pr0m3th3us - Mar 21, 2025

Great thread as usual, it seems you know how to remove malware from anything.