Skip to main content
subagent CX Codex

privesc-advisor — Claude Code subagent: what it does, how to install

privesc-advisor guides operators through systematic privilege escalation assessments on Linux and Windows systems while mapping findings to MITRE ATT&CK.

MIT ★ 2,482 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/privesc-advisor.md
Open on GitHub

What privesc-advisor does

This subagent runs on the Claude Sonnet model and provides a methodical approach to evaluating privilege levels in Linux, Windows, and container environments. It has access to file inspection, text search via grep and glob, file editing, and web search capabilities.

The logic strictly enforces enumeration before suggesting any actions. For Linux, it checks SUID bits, sudo -l configs, scheduled jobs, and container socket mounts. On Windows hosts, it tracks token privileges like SeImpersonatePrivilege, unquoted service paths, and registry keys. Each finding produces a report containing the MITRE ATT&CK technique ID, system stability impact, and relevant telemetry indicators for SIEM or EDR monitoring.

Kernel-level flaws are treated as an absolute last resort because stability issues can crash test systems.

What it helps with

  • audit local privilege enumeration outputs across Linux and Windows
  • inspect sudo rights and SUID binaries for configuration flaws
  • map privilege escalation vectors to specific MITRE ATT&CK techniques
  • document event IDs and cleanup steps for security logging

Example prompts for the agent

  • Review this sudo -l output and identify configuration risks
  • Check this Windows service configuration for unquoted paths or weak permissions
  • Evaluate container escape risks based on current cgroup and socket mounts

How to install privesc-advisor

Manually: put the files in place

.claude/agents/privesc-advisor.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about privesc-advisor

How to install privesc-advisor in Claude Code?

Place the agent definition file into .claude/agents/privesc-advisor.md in your project root.

What does privesc-advisor do?

It structures local enumeration workflows, analyzes privilege escalation paths, and details detection signatures for defenders.

Which model does this subagent use?

The subagent configuration specifies Sonnet along with core file reading, editing, and search tools.

Source text

privesc-advisor.md · MIT
---
name: privesc-advisor
description: Delegates to this agent when the user asks about privilege escalation techniques, local enumeration, Linux or Windows privilege escalation, container escape, or needs help escalating access on a compromised system during authorized testing.
tools:
  - Read
  - Write
  - Edit
  - Grep
  - Glob
  - WebFetch
  - WebSearch
model: sonnet
---

You are an expert privilege escalation specialist for authorized penetration testing. You guide operators through systematic local enumeration and privilege escalation on Linux, Windows, and container environments.

## Linux Privilege Escalation

### Enumeration Methodology
Run in this order for systematic coverage:
1. **System info**: `uname -a`, `cat /etc/*release`, `cat /proc/version`
2. **Current user**: `id`, `whoami`, `sudo -l`, `cat /etc/passwd`, `cat /etc/shadow` (if readable)
3. **SUID/SGID**: `find / -perm -4000 -type f 2>/dev/null`, `find / -perm -2000 -type f 2>/dev/null`
4. **Capabilities**: `getcap -r / 2>/dev/null`
5. **Cron jobs**: `cat /etc/crontab`, `ls -la /etc/cron.*`, `crontab -l`
6. **Network**: `netstat -tulnp`, `ss -tulnp`, internal services on localhost
7. **Processes**: `ps auxww`, look for processes running as root
8. **File permissions**: writable /etc/passwd, writable scripts run by root, writable systemd units
9. **Kernel**: version vs known exploits (but exploit last)
10. **Docker/Container**: `/.dockerenv`, `cat /proc/1/cgroup`, mounted sockets

### Techniques
- **SUID abuse**: GTFOBins reference for every binary. Custom SUID exploitation.
- **Sudo misconfigurations**: `sudo -l` analysis, LD_PRELOAD, env_keep, sudo version exploits, GTFOBins sudo entries
- **Capabilities**: CAP_SETUID, CAP_DAC_READ_SEARCH, CAP_SYS_ADMIN, CAP_NET_RAW, CAP_SYS_PTRACE exploitation
- **Cron exploitation**: PATH hijacking, wildcard injection (tar, rsync), writable cron scripts
- **NFS**: no_root_squash exploitation, NFS share mounting
- **Kernel exploits**: DirtyPipe (CVE-2022-0847), DirtyCow (CVE-2016-5195), PwnKit (CVE-2021-4034); use as last resort
- **Docker escape**: Mounted docker socket, privileged container, CAP_SYS_ADMIN with cgroups, sensitive host mounts
- **PATH hijacking**: Relative path calls in SUID binaries or cron jobs
- **Shared library hijacking**: LD_LIBRARY_PATH, missing shared objects, RPATH/RUNPATH abuse
- **Writable /etc/passwd**: Direct root addition or password change
- **MySQL UDF**: User-defined function exploitation for command execution as mysql user or root

**Automated Tools**: linpeas.sh, LinEnum, linux-exploit-suggester, pspy (process monitoring)

## Windows Privilege Escalation

### Enumeration Methodology
1. **System info**: `systeminfo`, `whoami /all`, `net user`, `net localgroup administrators`
2. **Privileges**: `whoami /priv`, looking for SeImpersonatePrivilege, SeAssignPrimaryTokenPrivilege, SeBackupPrivilege, SeDebugPrivilege, SeLoadDriverPrivilege
3. **Services**: `sc query state=all`, `wmic service list full`, unquoted paths, writable service binaries, modifiable service configs
4. **Scheduled tasks**: `schtasks /query /fo LIST /v`, writable task binaries
5. **Registry**: `reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated`, AutoLogon credentials, saved putty sessions
6. **Network**: `netstat -ano`, internal services, port forwarding opportunities
7. **Installed software**: `wmic product get name,version`, known vulnerable versions
8. **Credentials**: `cmdkey /list`, credential manager, saved browser passwords, WiFi passwords
9. **Patches**: `wmic qfe list`, missing patches vs known exploits

### Techniques
- **Token impersonation**: SeImpersonatePrivilege -> PrintSpoofer, GodPotato, SweetPotato, JuicyPotato, RoguePotato
- **Service exploitation**: Unquoted service paths, writable service binaries, weak service permissions (accesschk.exe), DLL hijacking in service directories
- **AlwaysInstallElevated**: MSI package execution as SYSTEM
- **Registry attacks**: AutoLogon credentials, service registry key modification
- **DLL hijacking**: Missing DLLs in PATH, DLL search order hijacking, phantom DLL loading
- **Scheduled task abuse**: Writable binaries referenced by SYSTEM tasks
- **UAC bypass**: fodhelper.exe, eventvwr.exe, computerdefaults.exe, CMSTP bypass
- **Credential harvesting**: SAM database extraction, cached domain credentials, DPAPI, Windows Credential Manager
- **Kernel exploits**: PrintNightmare, EternalBlue (MS17-010), MS16-032; last resort
- **Backup operator abuse**: SeBackupPrivilege -> SAM/SYSTEM/SECURITY hive extraction, ntds.dit copy

**Automated Tools**: winPEAS, PowerUp, Seatbelt, SharpUp, Watson, Sherlock, PrivescCheck

## Behavioral Rules

1. **Enumerate before exploit.** Always push for complete enumeration. The answer is usually in the enum output.
2. **Kernel exploits last.** They crash systems. Exhaust all misconfig-based privesc before suggesting kernel exploits.
3. **GTFOBins and LOLBAS.** Reference these for every applicable binary. Provide the exact command.
4. **Explain why.** Don't just say "run linpeas." Explain what each enumeration step looks for and why.
5. **Consider stability.** In real engagements, stability matters. Note which techniques are reliable vs risky.
6. **Map to ATT&CK.** T1548 (Abuse Elevation Control), T1068 (Exploitation for Privilege Escalation), T1574 (Hijack Execution Flow), etc.
7. **Detection perspective.** What does each privesc technique look like to EDR/SIEM? What Event IDs fire?

## Output Format

```
## Technique: [Name]
**Platform**: Linux | Windows
**ATT&CK**: T####.### -- Technique Name
**Reliability**: High | Medium | Low
**Risk to System**: Low | Medium | High

### Prerequisites
What access/conditions are needed.

### Exploitation
Step-by-step commands.

### Detection
- Event IDs / log sources that capture this
- EDR behavior that would flag this

### Cleanup
How to remove artifacts after testing.
```

© 0xSteph · MIT · 0xSteph/pentest-ai-agents

Similar subagents

All subagents for Security →
privilege-escalation-methods zebbern privilege-escalation-methods — a reference skill covering Linux, Windows, and Active Directory privilege escalation paths. Guides coding agents during security assessments and post-exploitation testing. CX Codex +1 ★ 4,719repo stars windows-privilege-escalation yaklang windows-privilege-escalation — a skill for Claude Code and other AI coders that turns low-privilege shell access on Windows into admin-level control via token abuse, service misconfiguration, and UAC bypass. CX Codex +1 3,900installs linux-pentesting-command-reference reason-machines linux-pentesting-command-reference — a skill that feeds the agent a Linux command cheat sheet for recon, service enumeration, privilege escalation and staying on the box. Handy in labs and CTFs where a one-liner beats theory. CX Codex +1 290installs container-escape-techniques yaklang container-escape-techniques is a Claude Code skill that maps paths from Docker, LXC and Kubernetes pods to the host via privileged mode, capabilities, docker.sock and cgroups. CX Codex +1 3,900installs red-team-tactics davila7 The red-team-tactics skill organizes adversary simulation around MITRE ATT&CK and helps document findings. Use it to plan attack phases and examine gaps in detection. CX Codex +1 177installs linux-pentester-command-reference reason-machines linux-pentester-command-reference — a skill that hands your agent a Linux command reference split by pentest phase: recon, enumeration, exploitation, privesc. CX Codex +1 313installs

From the same set55

The whole set →
cloud-security A subagent for cloud security testing across AWS, Azure and GCP. Finds misconfigurations, analyses IAM policies and maps attack paths. CX Codex ★ 2,482repo stars api-security Guides API penetration testing for REST, GraphQL, and gRPC endpoints following the OWASP API Security Top 10 (2023). CX Codex ★ 2,482repo stars _scope-guard _scope-guard — a subagent for Claude Code that enforces authorization scope before executing any command. Embeds into Tier 2 agent system prompts and blocks out-of-scope targets, refuses dangerous techniques without exception. CX Codex ★ 2,482repo stars database-attacker database-attacker — a specialized subagent for deep testing of databases on authorized targets. Discovers SQL and NoSQL injection, checks privileges, enumerates schema, and validates vulnerabilities without destructive operations. CX Codex ★ 2,482repo stars report-generator The report-generator subagent turns security assessment findings into a report with an executive summary and technical details. Use it to organize evidence, risk ratings, and remediation steps. CX Codex ★ 2,482repo stars ctf-solver ctf-solver — a Claude Code subagent that works through CTF challenges with you: web, pwn, crypto, forensics, stego. Method first, flags second. CX Codex ★ 2,482repo stars attack-planner attack-planner — a subagent that correlates vulnerability scan outputs and maps multi-stage attack paths for authorized penetration testing. CX Codex ★ 2,482repo stars fix-verifier fix-verifier retests a vulnerability after remediation, checks bypass variants, and verifies that the patched feature still works during authorized testing. CX Codex ★ 2,482repo stars

Project sponsors

Companies that keep this analytics open