agentleFS
fatihkanfatihkan/badi/.claude/skills-vault/pentest-privesc/SKILL.md

pentest-privesc

Skill8 starsChanged 3 months agoMITView on GitHub

Privilege escalation methodology — Linux + Windows + container escape advisory. LinPEAS/WinPEAS analysis, SUID/capability abuse, kernel exploit selection. Triggers on privesc, privilege escalation, LinPEAS, WinPEAS, SUID, capability, sudo abuse, kernel exploit, Windows token, UAC bypass.

The file

Files
SKILL.md

pentest-privesc

Linux + Windows + container privesc analysis. The user pastes LinPEAS/WinPEAS output; the skill prioritizes and suggests an exploit path.

Triggers

  • "linpeas output"
  • "winpeas output"
  • "how to privesc"
  • "SUID binary"
  • "sudo abuse"
  • "kernel exploit selection"
  • "container escape"
  • "UAC bypass"

Linux Privesc Vector List

VectorDetectionExploit Method
SUID binaryfind / -perm -4000GTFOBins lookup
Capabilitygetcap -r / 2>/dev/nullCAP_SETUID, CAP_DAC_READ_SEARCH
Sudo rulesudo -lGTFOBins (NOPASSWD bins)
Writable /etc/passwdls -la /etc/passwdecho "evil:x:0:0..." >>
Writable cronfind /etc/cron* -writableAdd a script
Path injectionsudo + relative pathPATH=/tmp:$PATH; ./binary
Kernel exploituname -aexploit-db version match
LD_PRELOADsudo env_keepmalicious .so
Docker socket/var/run/docker.sock readableContainer break
NFS no_root_squashmount sourceUID 0 file create
systemd timer writable/etc/systemd/*Timer override
Wildcard injectiontar/rsync wildcard--checkpoint-action

LinPEAS Output Analysis

# The user pastes the linpeas output, the skill reads it in this order:

1. SUID binary list -> filter exploitable per GTFOBins
2. Capability output -> CAP_SETUID / CAP_NET_ADMIN priority
3. Sudo rule -> NOPASSWD + GTFOBins
4. Cron + writable -> add-a-script path
5. PATH analysis -> is there a writable spot
6. Kernel version -> e.g. Dirty Pipe, OverlayFS, Sequoia

GTFOBins quick template: https://gtfobins.github.io — "shell", "sudo", "suid", "capabilities", "file write" filters.

Windows Privesc Vector

VectorDetectionExploit
Unquoted service pathwmic service get name,pathnameSpace in path + binplant
AlwaysInstallElevatedreg query HKLM\Software\Policies\Microsoft\Windows\InstallerElevation via MSI
Token impersonationwhoami /privSeImpersonate / SeAssignPrimaryToken
Stored credscmdkey /list, runas /savecredUse the saved cred
Weak service ACLaccesschk.exe -uwcqv "Authenticated Users" *Service modify
Registry autorunHKLM...\Run writablePersistence + elevation
Scheduled taskschtasks /queryTask command override
DLL hijackingProcess MonitorMissing DLL plant
Local admin via UAC bypassUAC level Autofodhelper.exe, eventvwr.exe
Print SpoolerPrintNightmare CVE-2021-1675Local driver install

WinPEAS Output Analysis

WinPEAS colored output -> prioritize red/yellow. The skill gives a BROAD explanation for a red finding + context for a yellow finding.

Token Impersonation (Windows)

Is SeImpersonatePrivilege present?
  -> YES: JuicyPotato (Win 10 < 1809), RoguePotato, PrintSpoofer (modern)
  -> Local SYSTEM gain

SeAssignPrimaryToken:
  -> spawn SYSTEM via CreateProcessAsUser

Kernel Exploit Selection

# Linux
uname -r                            # version
cat /etc/os-release                 # distro
ldd $(which sh) | head -1           # libc

# Exploit-DB lookup (offline searchsploit)
searchsploit "Linux Kernel <version> Local"
searchsploit Sequoia                # CVE-2021-33909
searchsploit "Dirty Pipe"           # CVE-2022-0847
searchsploit PwnKit                 # CVE-2021-4034
# Windows
systeminfo                          # version, hotfix
wmic qfe                            # patch list

# Windows-Exploit-Suggester (offline)
python wes.py systeminfo.txt

Container Escape

# Pod RBAC check
kubectl auth can-i --list

# Privileged container detection
cat /proc/self/status | grep CapEff   # cap effective
ls /dev | grep -i sd                  # host disk mount
mount | grep /etc/hostname             # host mount izi

# Common escapes:
- privileged: true + mount host /
- hostPID: true + nsenter -t 1 ...
- Docker socket bind /var/run/docker.sock
- CAP_SYS_ADMIN + cgroups release_agent
- runc CVE-2024-21626 (leaking file descriptor)

Output Template

## Privesc Path — <target>

### Detection
- Linux Ubuntu 22.04.3 LTS, kernel 5.15.0-86
- User "webapp" -> NOPASSWD sudo for /usr/bin/find
- /etc/cron.d/backup writable

### Prioritization
1. [QUICK WIN] sudo find . -exec /bin/sh \; -quit  (GTFOBins)
   -> single command, instant root
2. [BACKUP] cron writable, automatic root cmd after 5 min
3. [KERNEL] PwnKit (CVE-2021-4034) — check whether the kernel is patched, skip by default

### Recommendation (defensive)
- Remove find from sudo (NOPASSWD scope too broad)
- cron permissions root:root 644
- pkexec /usr/bin/pkexec PIE + libc audit

Out-of-Scope

  • Creating a persistent backdoor (outside the engagement)
  • Modifying production systems after compromise
  • Running exploits outside authorization

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.