in , ,

Linux Red Team Defense Evasion – Hiding Linux Processes

How to evade detection on Linux targets by hiding processes with libprocesshider

Prerequisites & Requirements

In order to follow along with the tools and techniques utilized in this document, you will need to use one of the following offensive Linux distributions:

  • Kali Linux
  • Parrot OS

The following is a list of recommended technical prerequisites that you will need in order to get the most out of this course:

  • Familiarity with Linux system administration.
  • Familiarity with Windows.
  • Functional knowledge of TCP/IP.
  • Familiarity with penetration testing concepts and life-cycle.

Note: The techniques and tools utilized in this document were performed on Kali Linux 2021.2 Virtual Machine 

MITRE ATT&CK Defense Evasion Techniques

Defense Evasion consists of techniques that adversaries use to avoid detection throughout their compromise. Techniques used for defense evasion include uninstalling/disabling security software or obfuscating/encrypting data and scripts. Adversaries also leverage and abuse trusted processes to hide and masquerade their malware. Other tactics’ techniques are cross-listed here when those techniques include the added benefit of subverting defenses.

The techniques outlined under the Defense Evasion tactic provide a clear and organized way of evading detection on a target system.

The following is a list of key techniques and sub-techniques that we will be exploring:

  1. Rootkits


Our objective is to hide our reverse shell connection process on the target Linux system in order to avoid detection.

Hiding Linux Processes With Libprocesshider

We can leverage Rootkits on Linux systems to hide our processes from the process tree in order to avoid detection by system administrators or security analysts.

This can be very helpful during red team engagements on Linux targets, primarily because suspicious processes can be easily identified in the process tree and consequently terminated by the blue team or security analysts.

We can accomplish this through the use of various Linux rootkits, however, we also want to avoid setting up any advanced Rootkits that can be detected by Linux rootkit checkers or AV scanners.

For this reason, we will be utilizing an open-source Linux utility called Libprocesshider that will allow us to hide a process on a Linux target by leveraging the ld preloader.

GitHub Repository:

The first step in the process will involve cloning the Librpocesshider GitHub repository onto the target system. This can be done by running the following command:

git clone

After cloning the repository you will need to determine the name of the process you would like to hide with Librpocesshider, this can be done by listing out the running processes on the system:

ps aux

In this case, I will be hiding the “” process as highlighted in the following screenshot.

In order to hide the “” process from the process tree, we will need to navigate to the Librpocesshider directory we just cloned and modify the “processhider.c” file. This can be done by running the following command:

vim processhider.c

You will then need to modify the “process_to_filter” value to the name of the process you would like to hide as shown in the screenshot below.

In this case, I will be hiding any occurrences of the “” process from the process tree. After making the change, you can save the file.

The next step will involve compiling the “processhider.c” file in to a shared object file, this can be done by running the following command:


The compilation will produce a shared object file called “” as shown in the following screenshot.

We will need to transfer this shared object file into the /usr/local/lib directory, this can be done by running the following command:

mv /usr/local/lib

We will then need to load the “” shared object with the global dynamic linker, this can be done by running the following command:

echo /usr/local/lib/ >> /etc/

We can now confirm that the “” process is hidden from the process tree by executing the script and listing out the running processes.

As shown in the preceding screenshot the active “” process is not displayed in the process tree and will therefore evade any detection by administrators or system analysts.

Linux Red Team Persistence Techniques

Linux Red Team Defense Evasion – Apache2 Rootkit