The Three Best Tools You Need to Scan Your Linux System for Malware... (2024)

The Three Best Tools You Need to Scan Your Linux System for Malware... (1)

Learn about the growing importance of scanning Linux systems for malware, and our favorite tools for doing so.

Why You Need to Protect Your Server against Malware

While Linux Servers are already extremely secure by default, there are extra steps you can and should take if you do have a Linux Server instance running. As with any system, vulnerabilities still exist and can wreak havoc if proper prevention and security best practices are not implemented. Of course, the most well known and most basic security tip people will tell you is to keep up to date with updates and security patches. (As we all should!) However, this will only do so much. Linux being amongst one of the most widely implemented and deployed operating systems makes it an attractive target for cybercriminals trying to steal your information, install malicious files on your system, and even try to run malicious scripts to take control of your system.

Nowadays, there are some people and even organizations who treat security as a secondary measure and sometimes, even treat it as a non-factor. LinuxSecurity values our role in helping you keep your Linux servers safe and secure as much as possible. In order to secure our server along with our data, and furthermore check whether our system has been compromised, we have created a list of the best malware scanners we’ve used over the years that will assist you in checking your system for any malware. This article will explore the security tools used for checking malware along with instructions on how to go about using these tools.

Of course you will be running these tools if you suspect there is malware on your system or if you are looking to prevent malware on your system, however, these tools are also just general security best-practices to audit your servers to further identify areas that could be secured.

What Types of Malware do Users and System Administrators Face Today?

Malware targeting Linux systems has increased tremendously over the past couple years, posing a threat to daily users and an even bigger headache for System Administrators. The different types of malware that Linux users can find themselves facing ranges from viruses and trojans to ransomware, botnets, keyloggers, worms, and even rootkits. System Administrators constantly have to find themselves keeping up with the latest Cyber threats and at times, can even find themselves part of a Zero-day attack if exposed to a malware that exploits unknown entry points into a system.

There are new attacks on the rise such as Cryptojacking and XorDDoS that have become rather troublesome. Cryptojacking involves Cybercriminals gaining unauthorized access of peoples devices to mine for cryptocurrency and these attacks are designed in such a way to be undetectable. An example of this would be the very recent Xbash malware. Xbash is a Python script that targets Linux servers and combines ransomware, mining, and botnet. These scripts contain commands to kill a list of processes. XorDdos, on the other hand, is a Trojan malware specific to Linux that utilizes rootkits and XOR encryption algorithm to carry out ‘SSH brute force’ attacks, and ultimately, use these devices as a botnet. These are just a few of the many types of malware out there that Cyber Criminals can and will use against your systems.

Preventative Measures to Keep Your System Secure

When it really comes down to it, it is better to take preventative measures rather than taking recuperative actions later on down the road. Now although systems cannot be fully “protected” from outside intruders, we can do our best to keep them at bay. Here are some preventative measures you can take beforehand to keep your system safe:

  • Update software regularly
  • Set up Linux security extensions for controlling and restricting access to data and resources
  • Use network segmentation to minimize the reach of a potential ransomware attack
  • Adopt a strong password policy
  • Set up network monitoring
  • Perform vulnerability scans and penetration tests
  • Regularly inspect event logs to identify anomalous behavior
  • Create system backups and include immutable backups
  • Set up IP filtering
  • Set up an intrusion detection system
  • Set up an intrusion prevention system
  • Ensure servers and endpoints are up to date with the latest security patches

Now if you have taken some of the preventative measures above, and some malicious malware still manages to make its way onto your Linux device, let's look at how we can detect malware that's already on our system. We advise you to take a look at this list of malware tools for Linux that we have devised to hopefully combat the up and rising malware attacks.

What If There's Malware? Our Top Choices for Linux Malware Scanning

We recommend these following malware tools to further audit your systems for any traces of malware.

Lynis

Lynis is an open-source security auditing tool for UNIX-based systems. It performs an in-depth security scan and is primarily used to test security defenses and provide insight for further system hardening as well as scanning for general system information, vulnerable software packages, and possible configuration issues. It also scans for security information, installed and available software information, configuration mistakes, security issues, user accounts without a password, wrong file permissions, firewall auditing

Use Case:

  • Security auditing
  • Compliance testing
  • Penetration testing
  • Vulnerability detection
  • System Hardening

How to install via terminal:The Three Best Tools You Need to Scan Your Linux System for Malware... (2)How to check Lynis Commands:The Three Best Tools You Need to Scan Your Linux System for Malware... (3)This should output:

The Three Best Tools You Need to Scan Your Linux System for Malware... (4)

Lynis audit Command:The Three Best Tools You Need to Scan Your Linux System for Malware... (5)

This should output:The Three Best Tools You Need to Scan Your Linux System for Malware... (6)Running the command lynis audit system generates two files: lynis.log and lynis-report.dat. The lynis.log file logs all the tests that were performed during the audit of the system and returns the result of said tests. The lynis-report.dat file contains a report that provides suggestions for strengthening the system. Ultimately, it reveals important information about your system’s security and possible misconfigurations and vulnerabilities. Here is a sample lynis-report.dat file:

The Three Best Tools You Need to Scan Your Linux System for Malware... (7)Chkrootkit

Rootkits give people the ability to remotely control your computer. Sometimes they can be difficult to detect and are even harder to remove. Chkrootkit is a tool to locally check for signs of a rootkit or simply put, it is basically a shell script that makes use of simple linux commands to check for discrepancies in the System binaries. Chkrootkit can easily identify a trojaned system command while it looks for known signatures.

How to install via terminal:The Three Best Tools You Need to Scan Your Linux System for Malware... (8)

How to check Chkrootkit Commands:The Three Best Tools You Need to Scan Your Linux System for Malware... (9)Chkrootkit Running:The Three Best Tools You Need to Scan Your Linux System for Malware... (10)

Chkrootkit with Grep:The Three Best Tools You Need to Scan Your Linux System for Malware... (11)This should output:The Three Best Tools You Need to Scan Your Linux System for Malware... (12)These messages are printed by chkrootkit during its tests:

  • "INFECTED": the test has identified a command probably modified by a known rootkit;
  • "not infected": the test didn't find any known rootkit signature.
  • "not tested": the test was not performed -- this could happen in
  • "nothing found": the command to be tested is not available;
  • "Vulnerable but disabled": the command is infected but not in use. (not running or commented in inetd.conf)

Chkrootkit in Expert mode:The Three Best Tools You Need to Scan Your Linux System for Malware... (13)This should output:The Three Best Tools You Need to Scan Your Linux System for Malware... (14)Chkrootkit in Expert mode with Grep:The Three Best Tools You Need to Scan Your Linux System for Malware... (15)This should output:The Three Best Tools You Need to Scan Your Linux System for Malware... (16)

The parameters that we specified in the chkrootkit -x | egrep ‘^/’ command will run chkrootkit in expert mode and specifies pathname strings in system commands and this helps when looking for suspicious strings in the system's binaries. Since chkrootkit's set of known signatures is fixed, this parameter helps to extend chkrootkit's abilities.

Rootkits pose a growing threat for the future. Chkrootkit is an Intrusion Detection System that helps to prevent potential harm that can be caused due to the existence of loopholes and possible entry points in your system and furthermore, helps in the remediation process if your system has been compromised.

Linux Malware Detect

Linux Malware Detect is a free and open source malware scanner for Linux that is designed to use threat data from network intrusion detection systems and create signatures of malware actively being used in attacks.

How to install via terminal:The Three Best Tools You Need to Scan Your Linux System for Malware... (17)Linux Malware Detect has to be downloaded from the R-fx Networks – Linux Software & Blog website. We use the command wget rfxn to get the download and save it in our current working directory.

How to extract the download:The Three Best Tools You Need to Scan Your Linux System for Malware... (18)

We use the tar -zxvf maldetect-current.tar.gz command to extract the tar file.

Change to maldetect-*version directory:The Three Best Tools You Need to Scan Your Linux System for Malware... (19)If we use the ls command to check the contents of our directory after extracting the tar file, we see that a new folder has been created called “maldetect-1.6.4”. We want to change to this directory using the command cd maldetect-1.6.4. Depending on the time you read this tutorial, there might be a different version of maldetect released so just make sure you pay attention to the directory name as it is bound to change with new releases.

Run the Install Script:The Three Best Tools You Need to Scan Your Linux System for Malware... (20)Using the ls command, we check the contents of our “maldet” directory that was created after extracting the file. We want to run the script called install.sh in this directory to install LMD. Use the command ./install.sh to run the installation script or run the command sh /path/to/file/install.sh depending on where your installation script is.

Doing this should output:The Three Best Tools You Need to Scan Your Linux System for Malware... (21)After installation, let’s edit the configuration file:The Three Best Tools You Need to Scan Your Linux System for Malware... (22)Using the vi /usr/local/maldetect/conf.maldet command, we can update the configuration file of maldet to edit some settings.

Email Alerts:The Three Best Tools You Need to Scan Your Linux System for Malware... (23)

Initially, when you first open the conf.maldet file, you will see that email_alert will be set to 0. If you would like to receive email notifications of the results when automated scans, set this value equal to 1. Underneath, you see a variable called email_addr. As the file states, this is the desired email to where you want your notifications sent. For testing purposes, I've used a “temp” email.

ClamAV configuration:The Three Best Tools You Need to Scan Your Linux System for Malware... (24)Initially, scan_clamscan will be set to 1. We want to leave it this way to enable clamav and LMD to work together to ultimately provide better performance when scanning. For Reference, ClamAV is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats.

Maldet commandsThe Three Best Tools You Need to Scan Your Linux System for Malware... (25)

Lets run a maldet command!The Three Best Tools You Need to Scan Your Linux System for Malware... (26)

maldet -a /var/log will scan the entire directory of /var/log.

After running, this is what will be outputted:The Three Best Tools You Need to Scan Your Linux System for Malware... (27)After running the command, this is what will be outputted on the screen. If you had email settings setup properly, you should have received an email. If not, let's take a look at how you can view a maldet report. At the bottom of the screen, you can see the output “scan report saved, to view run: maldet –report 220608-1246.68920”. The report name will vary from user to user, this is just my report name. So let's enter that command and see what we get below:

Maldet Report:The Three Best Tools You Need to Scan Your Linux System for Malware... (28)After opening the file, this is the report we are greeted with.You can see it scanned 4 files and there were 0 hits and 0 files cleaned. This means that no files were infected and it didn’t have to clean up anything.

Why These Three Tools?

There are many free, open-source malware detection tools available, however, since each users and/or System Administrators use case is different, we wanted to provide a list of tools that can be used for different purposes. Users and System Administrators alike can pick and choose the right tool for their current use case and install it via the command line or their respective interfaces.

Our Thoughts

As Cyber Criminals become more advanced with their scripts and as cyberthreats are on the rise, we are at a point in time where we cannot afford to have an unsecure system. There are roughly 2200 reported malware attacks each day, not accounting for the ones that go unreported, and it could be prevented with the proper measures. Using the tools above is the first initial step into keeping your server and ultimately, your systems secure. However, you should not just stop at that. Follow along with us as we continue to explore how you can further secure your linux servers and systems. To wrap this all up, we hope you found this article useful. Also be sure to check out our 'Complete Guide to Protecting a Linux Server from Hackers' for more tips and advice on securing Linux.

I'm an experienced cybersecurity enthusiast with a deep understanding of the challenges faced by Linux system administrators and users in today's threat landscape. Over the years, I've actively engaged in securing Linux servers, conducting vulnerability assessments, and implementing effective security measures. My expertise extends to various malware detection tools, allowing me to share insights into their functionalities and usage.

Now, let's delve into the concepts covered in the article:

1. Importance of Scanning Linux Systems for Malware:

  • Default Security: Linux servers are known for their default security measures, but additional steps are crucial.
  • Vulnerabilities: Even in secure systems, vulnerabilities exist, and without proper measures, they can be exploited.
  • Cybercriminal Target: Linux's widespread use makes it an attractive target for cybercriminals aiming to steal information, install malicious files, or gain control through scripts.

2. Types of Malware Targeting Linux Systems:

  • Diverse Threats: Linux users and administrators face a range of threats, including viruses, trojans, ransomware, botnets, keyloggers, worms, and rootkits.
  • Emerging Threats: New threats like Cryptojacking and XorDDoS are on the rise, adding complexity to the security landscape.

3. Preventative Measures for System Security:

  • Regular Updates: Keeping software updated is fundamental for security.
  • Security Extensions: Implementing Linux security extensions for access control.
  • Network Segmentation: Minimizing the impact of potential ransomware attacks through network segmentation.
  • Password Policies: Enforcing strong password policies for user accounts.
  • Monitoring and Auditing: Network monitoring, vulnerability scans, penetration tests, and event log inspection.
  • Backups: Creating system backups, including immutable backups.

4. Recommended Linux Malware Scanning Tools:

  • Lynis:

    • Functionality: Open-source security auditing tool for UNIX-based systems.
    • Use Cases: Security auditing, compliance testing, penetration testing, vulnerability detection, system hardening.
    • Installation: Terminal commands provided for installation and usage.
  • Chkrootkit:

    • Functionality: Locally checks for signs of rootkits using Linux commands.
    • Use Cases: Detection of modified system commands, identification of known signatures.
    • Installation: Terminal commands for installation and expert mode usage.
  • Linux Malware Detect:

    • Functionality: Open-source malware scanner using threat data from network intrusion detection systems.
    • Installation: Detailed steps for downloading, extracting, and configuring.
    • Commands: Example commands for scanning directories and interpreting reports.

5. Why These Three Tools:

  • Diversity of Use Cases: Each tool serves different purposes, allowing users and administrators to choose based on their specific needs.
  • Flexibility: The article emphasizes that users can pick tools based on their unique use cases and preferences.

6. Closing Thoughts:

  • Increasing Cyber Threats: Acknowledging the rising sophistication of cyber threats and the need for robust security measures.
  • Daily Malware Attacks: Highlighting the alarming frequency of reported malware attacks and the importance of preventative actions.

In conclusion, this article provides valuable insights into the evolving threat landscape faced by Linux systems and offers practical advice on securing servers through a combination of preventative measures and the use of effective malware scanning tools.

The Three Best Tools You Need to Scan Your Linux System for Malware... (2024)
Top Articles
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated:

Views: 5667

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.