Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Systematic privilege escalation methodology for authorized security assessments, CTF
challenges, and penetration testing engagements. Covers Linux systems, containers, Kubernetes
clusters, VPN infrastructure, and IaC credential exposure.
This skill is offensive - it assumes you have initial access and guides escalation to higher
privileges. For defensive hardening and vulnerability scanning, use the security-audit skill
instead.
When to use
Authorized penetration testing engagements (with written scope)
CTF challenges and security training labs (HTB, THM, PG, etc.)
Post-exploitation enumeration after gaining initial shell access
Red team exercises with defined rules of engagement
Assessing your own infrastructure for privilege escalation paths
Container escape and Kubernetes RBAC abuse testing
VPN credential extraction and lateral movement assessment
When NOT to use
Defensive security reviews or hardening (use security-audit)
Without written authorization from the system owner
AI Self-Check
Before executing any technique or generating exploitation commands, verify:
Authorization confirmed: written scope document or CTF/lab context established
Target in scope: IP/hostname/namespace is within the authorized boundary
No production data access: avoid reading actual user data beyond what's needed to prove access
Evidence captured: command output logged for the report before moving on
Cleanup planned: any files dropped, users created, or configs modified are tracked for removal
No destructive actions: kernel exploits tested in lab first, no rm -rf, no disk writes to critical paths
Architecture matched: exploit/payload matches target arch (uname -m). x86_64 exploits don't work on ARM, 32-bit payloads fail on 64-bit-only systems
Reverse shells use authorized ports: listener IP and port match the engagement plan
Current source checked: dated versions, CLI flags, API names, and support windows are verified against primary docs before repeating them
Hidden state identified: local config, credentials, caches, contexts, branches, cluster targets, or previous runs are made explicit before acting
Verification is real: final checks exercise the actual runtime, parser, service, or integration point instead of only linting prose or happy paths
Authorization confirmed: scope, target, time window, and rules of engagement are explicit before privesc work
Destructive paths avoided: exploit attempts preserve evidence and avoid persistence, data damage, or lateral movement unless explicitly authorized
Performance
Run low-noise enumeration first; expensive scanners and brute-force tools require scope and rate limits.
Capture command output as you go so repeated enumeration is unnecessary.
Prioritize likely local privesc paths from kernel, sudo, SUID, services, containers, and writable paths before broad tool dumps.
Best Practices
Keep CTF shortcuts out of real pentest guidance unless the user says it is a CTF.
Document exact preconditions and proof for every privilege boundary crossed.
Do not install persistence or cleanup evidence unless the engagement explicitly requires and authorizes it.
Workflow
Phase 1: Situational Awareness
Determine what you're working with before trying anything.
# Who am I, what can I do?id && hostname && uname -a && cat /etc/*-release 2>/dev/null
# Am I in a container?cat /proc/1/cgroup 2>/dev/null | grep -qiE 'docker|kubepods|containerd' && echo"CONTAINER" || echo"HOST"ls -la /.dockerenv 2>/dev/null && echo"Docker container detected"cat /proc/self/mountinfo | grep -q 'kubepods' && echo"Kubernetes pod detected"# What's the network look like?
ip addr && ip route && ss -tulpn
Decision tree:
Bare metal / VM -> Phase 2 (Linux privesc)
Docker container -> Phase 5 (container breakout)
Kubernetes pod -> Phase 6 (k8s privesc)
Any of the above -> also check Phase 7 (VPN/secrets) and Phase 8 (IaC)
Phase 2: Linux Privilege Escalation
Core Linux privesc methodology. Start with automated enumeration, then work through
manual techniques.
SSH agent hijacking - SSH_AUTH_SOCK socket theft from other users, key injection, tunnel pivoting (-L, -R, -D)
Phase 5: Container Breakout
If you're inside a container, look for escape vectors. The --privileged flag is the critical enabler - it disables all security mechanisms (seccomp, AppArmor, capability drops, device cgroup) and grants full access to host devices. A privileged container is effectively root on the host.
Read references/container-breakout.md for the full technique library
covering:
Docker socket - mounted /var/run/docker.sock -> full host access
Namespace escape - nsenter, /proc/1/root, user namespace breakout
Quick check:
# Am I privileged?
ip link add dummy0 type dummy 2>/dev/null && echo"PRIVILEGED" && ip link del dummy0
# Docker socket?ls -la /var/run/docker.sock 2>/dev/null
# Capabilities?cat /proc/self/status | grep -i capeff
# capsh if available
capsh --print 2>/dev/null
# Host mount?
mount | grep -E '^/dev/' | grep -v 'overlay'
Phase 6: Kubernetes Privilege Escalation
If you're inside a k8s pod or have access to a kubeconfig.
Read references/kubernetes-privesc.md for the full technique library
covering:
ServiceAccount token - auto-mounted at /var/run/secrets/kubernetes.io/serviceaccount/, API access, token scoping (pre/post 1.24)
references/shells-and-pivoting.md - reverse shells, SSH tunneling, agent hijacking, port forwarding, file transfer
Scope Boundaries
Windows targets: This skill covers Linux, containers, and Kubernetes. Windows privilege escalation (token impersonation, SeImpersonatePrivilege, PrintSpoofer, AD abuse, Kerberoasting) is a separate domain not covered here. For Windows CTF/pentest, research Windows-specific tooling (WinPEAS, PowerUp, Rubeus, BloodHound) directly.
Evidence Capture Template
Rule 4 says document everything. Use this structure per finding:
## Finding: [short name]
- **Vector**: [sudo/SUID/cron/container/k8s/kernel/etc.]
- **Access before**: [user/group, e.g., www-data]
- **Access after**: [user/group, e.g., root]
- **Steps**: [numbered list of exact commands run]
- **Proof**: [command output showing escalated access, e.g., id, whoami, cat /root/proof.txt]
- **Cleanup**: [files created, users added, configs changed - and how to reverse]
- **Remediation**: [what the defender should fix]
Capture script -q /tmp/session.log at the start of each engagement to get a full terminal transcript.
Output Contract
See skills/_shared/output-contract.md for the full contract.
Skill name: LOCKPICK
Deliverable bucket:audits
Mode: conditional. When invoked to analyze, review, audit, or improve existing repo content, emit the full contract -- boxed inline header, body summary inline plus per-finding detail in the deliverable file, boxed conclusion, conclusion table -- and write the deliverable to docs/local/audits/lockpick/<YYYY-MM-DD>-<slug>.md. When invoked to answer a question, teach a concept, build a new artifact, or generate content, respond freely without the contract.
Severity scale:P0 | P1 | P2 | P3 | info (see shared contract; only used in audit/review mode).
Related Skills
security-audit - defensive counterpart. Finds vulnerabilities through SAST, dependency scanning, and config review. This skill exploits them. Use security-audit for hardening; use lockpick for proving exploitability.
networking - configures and troubleshoots VPNs, DNS, proxies, firewalls. Lockpick's VPN section extracts credentials and keys from existing configs for lateral movement. Use networking for setup; use lockpick for exploitation.
kubernetes - writes and reviews k8s manifests and Helm charts. Lockpick's k8s section attacks the cluster from inside a compromised pod. Use kubernetes for building; use lockpick for breaking.
docker - Dockerfile and Compose authoring. Lockpick's container section escapes from running containers. Use docker for building images; use lockpick for escaping them.
ansible - playbook and role authoring. Lockpick's IaC section targets Ansible vault cracking and credential extraction, not playbook writing.
terraform - IaC authoring. Lockpick's IaC section targets state file secret extraction, not Terraform module design.
Rules
Authorization is non-negotiable. Every technique requires written authorization or a CTF/lab context. No exceptions, no "it's my own box" without explicit confirmation.
Enumerate before exploiting. Run through the full enumeration checklist before attempting kernel exploits or destructive techniques. The easy wins (sudo, SUID, cron) are safer and more reliable.
Kernel exploits are last resort. They can crash the system, corrupt memory, or trigger panic. Try everything else first. Test in a lab environment when possible.
Document everything. Capture command output before moving to the next technique. Evidence of the escalation path is the deliverable, not just root access.
Clean up after yourself. Track files created, users added, configs modified. Remove them at the end of the engagement or note them for the client.
Don't access unnecessary data. Proving root access doesn't require reading actual user data. A whoami or /root/proof.txt is enough.
Stay in scope. Lateral movement to systems outside the authorized boundary is out of scope unless explicitly permitted.
Prefer living off the land. Use tools already on the system before uploading custom binaries. Less forensic footprint, fewer detection triggers.