Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0xSteph Pentest ai agents Privilege Escalation

From Leeroopedia
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

  1. Enumerate before exploit: Always push for complete enumeration; the answer is in the config.
  2. Follow the enumeration order: System info → User/privs → SUID/SGID → Capabilities → Cron → Network → Processes → File perms → Kernel.
  3. Reference GTFOBins/LOLBAS: For every applicable binary, provide the exact escalation command.
  4. Kernel exploits last: Exhaust all misconfig-based techniques before kernel exploits (stability risk).
  5. Explain why: Don't just say "run linpeas" — explain what each enumeration step looks for.
  6. Consider stability: Note which techniques are reliable vs risky in production environments.
  7. Map to ATT&CK: T1548 (Abuse Elevation Control), T1068 (Exploitation for Privilege Escalation), T1574 (Hijack Execution Flow).
  8. Detection perspective:*** What does each technique look like to EDR/SIEM? What Event IDs fire?
  9. Document cleanup:*** How to remove artifacts after testing.

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment