Linux Privilege Escalation

Overview

Privilege escalation in Linux involves techniques to gain higher-level access to a system, typically from a normal user to root access.

Kernel Exploits

1. Kernel Information

# Kernel Version
uname -a
cat /proc/version
dmesg | grep Linux

# Kernel Modules
lsmod
cat /proc/modules
# Search for Exploits
searchsploit <kernel_version>
exploit-db.com
github.com

# Compile and Run
gcc exploit.c -o exploit
chmod +x exploit
./exploit

SUID/SGID Binaries

1. Find SUID/SGID Files

2. Common SUID/SGID Exploits

Capabilities

1. Check Capabilities

2. Exploit Capabilities

Cron Jobs

1. Check Cron Jobs

2. Exploit Cron Jobs

Services

1. Check Services

2. Exploit Services

Environment Variables

1. Check Environment

2. Exploit Environment

NFS

1. Check NFS

2. Exploit NFS

Tools

1. Primary Tools

  • LinPEAS

  • LinEnum

  • Linux Exploit Suggester

  • GTFOBins

  • Metasploit

2. Additional Tools

  • Pspy

  • Pspy64

  • Linux Smart Enumeration

  • BeRoot

  • Unix Privesc Check

Best Practices

1. Escalation Strategy

  • Start with automated tools

  • Check common vectors

  • Document findings

  • Test exploits safely

  • Follow engagement scope

2. OPSEC Considerations

  • Use stealth techniques

  • Avoid detection

  • Monitor for alerts

  • Use legitimate tools

  • Follow engagement scope

Resources


Last Updated: 2025-03-2

Last updated

Was this helpful?