LinPEAS Basics: Find Privilege Escalation Paths on Your Own Linux Box (Legally)


Getting a low-privilege shell on a Linux box is only half the job. The real question is: can you become root? LinPEAS (Linux Privilege Escalation Awesome Script) answers that question in seconds. It scans a system and highlights every misconfiguration an attacker could use to escalate privileges — and it’s one of the most useful defensive tools you can run on your own machines. Only ever run it on systems you own or have written permission to test.

What LinPEAS Actually Does

LinPEAS is a single shell script that checks hundreds of things: SUID and SGID binaries, sudo rules, writable system files, cron jobs, kernel version against known exploits, environment variables, Docker and container escapes, history files with passwords, and much more. It color-codes the output — red and yellow items deserve your attention first.

Getting It Into Your Lab

Download it on your own VM or lab machine. The project lives on GitHub (peass-ng/PEAS-ng). A common way to fetch the latest stable script:

curl -L https://github.com/peass-ng/PEAS-ng/releases/latest/download/linpeas.sh -o linpeas.sh
chmod +x linpeas.sh

Or clone the whole repository if you want the source and the Windows equivalent, WinPEAS, too. Verify the download’s hash against the release page before running anything you fetched from the internet — that’s a habit worth building now.

Running Your First Scan

./linpeas.sh

That’s it. The scan takes a minute or two and prints a long report. Useful options:

  • ./linpeas.sh -a — run all checks, including slower ones.
  • ./linpeas.sh -s — superfast mode, skips the slow checks.
  • ./linpeas.sh | tee linpeas-report.txt — save the output to a file you can search later.

LinPEAS needs no root to run — it reports what a normal user can see, which is exactly the attacker’s view. Run it as root too, and it checks even more.

Reading the Results

Don’t panic at the wall of text. Work through it in this order:

  • SUID binaries: LinPEAS flags binaries that run as root when any user executes them. Most are normal (sudo, passwd), but an unusual one — a custom script, an old editor, a copy of vim or find with SUID set — is a classic escalation path.
  • Sudo rules: sudo -l output shows what your user can run as root without a password. A rule like (ALL) NOPASSWD: /usr/bin/vim is effectively root.
  • Writable files and cron jobs: A cron job running as root that executes a script you can write to is a straight road to root. LinPEAS highlights writable paths in cron and systemd units.
  • Kernel version: LinPEAS matches your kernel against public exploits. An old kernel on a server you manage is a patching job, not a curiosity.
  • Secrets in files: History files, config files and backups sometimes contain plaintext passwords. LinPEAS greps for them — then you rotate them.

Fixing What It Finds

LinPEAS is a finder, not a fixer. The fixes are usually simple:

  • Remove SUID from binaries that don’t need it: sudo chmod u-s /path/to/binary.
  • Tighten sudo rules so users get only the exact commands they need, with passwords required.
  • Make cron scripts and their directories writable only by root.
  • Patch the kernel and remove stale credentials from files.

Then run LinPEAS again and watch the red lines disappear. That’s the whole loop: scan, fix, rescan.

The Defensive Mindset

Running LinPEAS on your own servers is one of the fastest ways to learn Linux security — every finding teaches you a real misconfiguration pattern. The same patterns appear in CTF machines and bug bounty reports, so the skill transfers directly. Scan your own lab, fix what it finds, and only test systems you own or have written permission to test.

Comments

Popular Posts