Privilege escalation is a critical concern in Linux system security. One common avenue for achieving privilege escalation is through exploitable binaries. In this blog post, we will explore how to utilise the getcap command in Linux to identify binaries that possess dangerous capabilities, providing potential opportunities for privesc.

What is getcap?

The getcap command is used to retrieve the file capabilities of binaries in Linux systems. File capabilities are a feature introduced to enhance security by providing specific permissions to execute certain operations without requiring full root privileges. However, if misconfigured or utilised improperly, these capabilities can become security vulnerabilities.

Step 1: Understanding File Capabilities

Before diving into identifying exploitable binaries, it’s essential to grasp the concept of file capabilities. In Linux, capabilities can be assigned to individual binaries, allowing them to execute specific operations with elevated privileges. Some commonly used capabilities include CAP_NET_ADMIN for network administration, CAP_SYS_ADMIN for system administration, and CAP_DAC_OVERRIDE for bypassing file permission checks.

Step 2: Locating Binaries with Capabilities

To identify binaries with capabilities on your Linux system, open a terminal and run the following command:

$ getcap -r / 2>/dev/null

This command searches the entire file system recursively (-r) starting from the root directory (/) and suppresses error messages (2>/dev/null). The output will provide a list of binaries along with their associated capabilities, if any.

Step 3: Analysing the Results

Once you have the list of binaries with capabilities, it’s time to analyse the results. Look for binaries that have high-privileged capabilities, such as CAP_SYS_ADMIN or CAP_DAC_OVERRIDE. These capabilities grant extensive access and are potential targets for privilege escalation.

Step 4: Researching Vulnerabilities

For the binaries identified in the previous step, perform research to determine if any known vulnerabilities exist that could be exploited to achieve privilege escalation. Consult vulnerability databases, security advisories, and relevant forums to gather information about potential exploits.

Step 5: Applying Mitigations

Once you have identified potentially exploitable binaries and vulnerabilities, it’s crucial to implement mitigations. This may involve patching the binaries, updating the software, or applying access control measures to restrict their usage.


The getcap command in Linux is a valuable tool for identifying binaries with capabilities that may lead to privilege escalation. By understanding the concept of file capabilities, analysing the results, researching vulnerabilities, and applying appropriate mitigations, you can enhance the security of your Linux system and protect it from potential privesc attacks.

Remember, always exercise caution and ensure you have proper authorisation before attempting any security testing or analysis on systems.