Principle:0xSteph Pentest ai agents Privilege Escalation
| Knowledge Sources | |
|---|---|
| Domains | Security, Privilege_Escalation, Methodology |
| Last Updated | 2026-10-22 12:00 GMT |
Overview
Systematic methodology for escalating privileges on compromised systems through local enumeration and exploitation of misconfigurations, capabilities, and kernel vulnerabilities.
Description
Privilege Escalation is the process of gaining elevated access (root, SYSTEM, domain admin) from an initial low-privilege foothold. It addresses the problem that initial access typically grants only user-level permissions, while demonstrating full compromise requires elevated privileges. The principle emphasizes enumeration before exploitation: the answer to "how do I escalate?" is almost always in the system's configuration, not in a kernel exploit.
The principle covers three platforms: Linux (SUID/SGID, sudo misconfigs, capabilities, cron exploitation, NFS, kernel exploits), Windows (token impersonation, service exploitation, AlwaysInstallElevated, DLL hijacking, UAC bypass), and containers (Docker socket, privileged containers, CAP_SYS_ADMIN). Kernel exploits are always the last resort due to stability risk.
Usage
Use this principle when:
- You have user-level access on a compromised system and need to escalate
- Systematic local enumeration is needed to identify escalation vectors
- Windows privilege escalation via token impersonation (SeImpersonatePrivilege) is needed
- Container escape from a compromised container is required
Theoretical Basis
Privilege escalation follows an enumeration-first model:
Failed to parse (syntax error): {\displaystyle \text{Escalation Path} = \text{enumerate}(\text{system}) \rightarrow \text{identify\_misconfig} \rightarrow \text{exploit}(\text{misconfig}) }
Pseudo-code Logic:
# Abstract privesc algorithm (NOT real implementation)
def find_escalation_path(system, current_user):
# Phase 1: Systematic enumeration (always first)
info = enumerate_system(system) # uname, systeminfo
privileges = enumerate_privs(user) # sudo -l, whoami /priv
files = enumerate_suid_sgid() # SUID/SGID binaries
caps = enumerate_capabilities() # getcap -r /
services = enumerate_services() # sc query, cron
network = enumerate_network() # netstat, ss
# Phase 2: Match against known escalation patterns
for pattern in ESCALATION_PATTERNS:
if pattern.matches(info, privileges, files, caps, services):
yield EscalationTechnique(
command=pattern.exploit_command,
reliability=pattern.reliability,
risk=pattern.system_risk,
cleanup=pattern.cleanup_steps
)
# Phase 3: Kernel exploits (LAST RESORT)
if no_misconfig_found:
kernel_exploits = match_kernel_version(info.kernel)
yield from sorted(kernel_exploits, key=lambda e: e.reliability, reverse=True)
Practical Guide
- Enumerate before exploit: Always push for complete enumeration; the answer is in the config.
- Follow the enumeration order: System info → User/privs → SUID/SGID → Capabilities → Cron → Network → Processes → File perms → Kernel.
- Reference GTFOBins/LOLBAS: For every applicable binary, provide the exact escalation command.
- Kernel exploits last: Exhaust all misconfig-based techniques before kernel exploits (stability risk).
- Explain why: Don't just say "run linpeas" — explain what each enumeration step looks for.
- Consider stability: Note which techniques are reliable vs risky in production environments.
- Map to ATT&CK: T1548 (Abuse Elevation Control), T1068 (Exploitation for Privilege Escalation), T1574 (Hijack Execution Flow).
- Detection perspective:*** What does each technique look like to EDR/SIEM? What Event IDs fire?
- Document cleanup:*** How to remove artifacts after testing.
Related Pages
Implemented By
- Implementation:0xSteph_Pentest_ai_agents_Privesc_Advisor_Agent
- Implementation:0xSteph_Pentest_ai_agents_AD_Attacker_Agent
- Implementation:0xSteph_Pentest_ai_agents_Findings_CLI