Skip to content
All modules
AdvancedModule 26 of 2790 minutes

After the shell: privilege escalation

A shell is the middle of the challenge. Enumerate systematically, recognise the misconfiguration classes, and know what a Windows token actually grants.

Assumes14. Server-side takeover: from input to execution

By the end you can

  • Enumerate a Linux host in a fixed order and explain what each step rules out
  • Exploit SUID binaries, sudo rules and capabilities, and say which of the three is present from the evidence
  • Escape a restricted shell and a limited PATH
  • Read a Windows access token - user, groups, privileges, integrity level - and name what it permits
  • Explain how impersonation converts one privilege into another account's authority
  • Find persistence and scheduled execution as an attacker would, and as a defender would

1. Read

2. Use the tools

In the order they come up while solving. Read what each one does, or go straight to the workspace tab that runs it.

3. Try one now

Generated in your browser and checked in your browser. No account, nothing to download, and a fresh one whenever you want another.

4. Practise on the real thing

Real picoCTF challenges that use these techniques, easiest first. 29 match in total - see the full index.

Common mistakes

The wrong turns this topic reliably produces. Written as the mistake rather than the rule, because the rule is easy to agree with and easy to walk straight past.

  • Running an enumeration script and reading only the highlighted lines. The tool ranks by generic likelihood; the challenge's intended path is usually the odd entry it did not colour.
  • Reading Administrator membership as authority on Windows. Privileges are per-token and can be disabled, and integrity level constrains what the token can touch regardless of groups.
  • Assuming a writable file is a win. It matters only if something privileged reads it, and finding that reader is the actual work.
  • Reading a sudo rule as safe because the binary looks harmless. Anything that writes a file, loads a plugin or spawns an editor is a shell, so the question about each entry is what it can be made to run, not what it is for.
  • Escalating before establishing what the current shell already is. A container namespace, a restricted shell and a reduced capability set each change what root would even mean here, and escaping is a different problem from escalating.

Checkpoint

From an unprivileged shell, escalate to root or SYSTEM and write the path as a chain: what you found, why it was privileged, and what it let you do next.

Teaching note

Enumeration is boring and students skip it, then spend an hour on a guess. Make the first pass entirely enumeration with no exploitation allowed, and have them hand in the list before touching anything - the intended path is almost always already on the list.

Go deeper

The lessons above are written to get you through a challenge. These are the chapters to read when you want the subject instead - each one named so you can check it rather than take our word for it. Nothing here is affiliate-linked or sold by us.

  • Black Hat Bash - Dolev Farhi and Nick Aleks

    Chapter 8, Local Information Gathering

    The enumeration checklist as shell code, which makes the order explicit rather than tribal.

  • Black Hat Bash - Dolev Farhi and Nick Aleks

    Chapter 9, Privilege Escalation

    The Linux misconfiguration classes, each with the check that detects it.

  • Windows Security Internals - James Forshaw

    Chapter 4, Security Access Tokens

    The authoritative account of what a token is, which is the object every Windows escalation manipulates.

  • Windows Security Internals - James Forshaw

    Chapter 7, The Access Check Process

    The algorithm that decides every allow or deny, so escalation stops being a list of tricks.