Skip to main content

Overview

Linux privilege escalation involves finding and exploiting misconfigurations, vulnerable software, weak permissions, or kernel vulnerabilities to elevate from a low-privilege user to root. This page covers the most impactful techniques with practical commands.
This content is for authorized penetration testing and security research only. Always obtain written permission before testing any system.

System Enumeration

OS and Kernel Information

Environment Variables

Interesting information, passwords, or API keys may live in environment variables:

Sudo Version Check

Sudo versions before 1.9.17p1 allow unprivileged local users to escalate via sudo --chroot when /etc/nsswitch.conf is in a user-controlled directory (CVE-2025-32463). For versions below 1.8.28: sudo -u#-1 /bin/bash

SUDO and SUID Exploitation

Common GTFOBins sudo escalations:
If sudo -l shows a NOPASSWD entry:
Exploit it:
If sudo allows SETENV:
If env_keep includes BASH_ENV:
If sudo -l shows env_keep+=PATH or a writable entry in secure_path:
If sudo preserves LD_PRELOAD:

Cron Job Abuse

1

Enumerate Cron Jobs

2

Cron PATH Hijacking

If a cron job runs a script without full path and the cron PATH includes a user-writable directory:
3

Wildcard Injection

When a cron job uses * in a command like rsync:
4

Cron Script Overwrite

If you can modify a cron script:
5

Monitor Frequent Cron Jobs

Use pspy or manual process monitoring to spot short-interval crons:

Services and Systemd

If you can write to a .service file, add a backdoor:
Check the systemd PATH and look for relative command use in service files:
Create an executable with the same name in a writable PATH directory.
Add a backdoor to .socket files:
If a socket references a non-existent service and you can write to /etc/systemd/system:

Process Memory Credential Dumping

Memory Dump Script

mimipenguin

The tool mimipenguin steals cleartext credentials from memory:

Network Enumeration

Docker Socket Privilege Escalation

If /var/run/docker.sock is writable:
Using the Docker API directly with curl:

D-Bus Privilege Escalation

D-Bus is an IPC system that can allow privilege escalation if misconfigured policies exist:

SUID / SGID Binaries

SUID binaries run with the file owner’s permissions (typically root). Find and exploit them:
Check each result against GTFOBins for known escalation techniques. Common examples:

Linux Capabilities

Capabilities are fine-grained privileges. Find binaries with dangerous capabilities:
Dangerous capabilities to look for: Examples:

Kernel Exploits

Search for kernel exploits matching the target version:
Notable kernel vulnerabilities:

Writable PATH and Environment

Credentials in Files

References