Privilege escalation is one of the most critical skills in penetration testing and one of the most important attack paths for defenders to understand and close. It is the process of moving from a limited user account to a higher-privileged one – demonstrating exactly how far an attacker could go after gaining initial access to a system.
In ethical hacking, privilege escalation occurs during the post-exploitation phase. After an attacker gains initial access — often as a low-privileged web server process, a standard domain user, or a guest account — the next objective is to elevate those privileges to gain administrative or system-level control. On Windows, this means reaching Administrator or SYSTEM. On Linux, it means reaching root. Understanding privilege escalation from both perspectives is essential for the security community. Penetration testers use it to demonstrate real-world risk to clients. System administrators and blue team analysts use that knowledge to identify and close misconfigurations that enable escalation before a real attacker finds them.
Think of privilege escalation like a new employee starting in the mailroom. They have limited building access – they can enter the lobby and the mailroom but nothing else. Privilege escalation is the process of finding a forgotten keycard on a desk, a door left propped open, or a supervisor’s login credentials posted on a sticky note — and using that discovery to access floors they were never supposed to reach.
Types of privilege escalation
Type 01: Vertical escalation, low to high
Moving from a low-privilege account to a high-privilege one — for example, from a standard user account to Administrator on Windows or from www-data to root on Linux. This is the primary goal in most penetration tests.
Type 02: Horizontal escalation (Peer to peer)
Moving from one account to another at the same privilege level — accessing another user’s data, files, or session without gaining administrative privileges. Common in web applications and multi-user systems with weak access controls.
Common privilege escalation techniques – Linux and Windows
LinuxL Sudo misconfiguration (Very common)
When a user is allowed to run specific commands as root via sudo without a password, or when sudo is configured with wildcard permissions, it can often be abused to execute arbitrary commands as root through GTFOBins techniques.
Linux: SUID binary abuse (Frequently missed)
Set User ID (SUID) binaries run with the owner’s privileges rather than the caller’s. When a SUID binary belongs to root and can be abused to execute shell commands — as documented in GTFOBins — it provides a direct path to root access.
Windows: Unquoted service paths (Classic finding)
Windows services with unquoted executable paths containing spaces are vulnerable. Windows searches each space-delimited path component before reaching the real binary, allowing a low-privileged attacker to place a malicious executable in a location Windows checks first.
Windows: Weak service permissions (High impact)
When a Windows service’s ACL allows a low-privileged user to modify the binary path or reconfigure the service, the attacker can replace the service executable with their own payload, which then runs at the service’s privilege level, often SYSTEM.
Both: Kernel exploits (Unpatched systems)
Exploiting known vulnerabilities in the OS kernel to achieve ring 0 code execution. Kernel exploits are highly reliable when they exist, but require an unpatched target. DirtyPipe (Linux) and PrintSpoofer (Windows) are well-known recent examples covered in OSCP training.
Both: Credential reuse (Most overlooked)
Finding stored credentials in config files, environment variables, history files, and registry keys that belong to higher-privileged accounts. Credential reuse is consistently the most common privilege escalation path discovered in real penetration testing engagements.
Privilege escalation practical examples



The two most important automated enumeration tools for privilege escalation are linPEAS for Linux and winPEAS for Windows — both part of the PEASS-ng project. These scripts check hundreds of known privilege escalation vectors in seconds and colour-code results by severity. Every penetration tester should run them immediately after gaining initial access on an authorised target to identify the fastest and most reliable escalation path available on that specific system configuration.
Defensive measures against privilege escalation
Defence 01: Principle of least privilege
Every user, process, and service account should have only the minimum permissions required for its specific function. Over-permissioned accounts are the root cause of most privilege escalation findings in real assessments.
Defence 02: Patch management
Keep all operating systems, kernels, and software fully patched. Kernel-level privilege escalation exploits require an unpatched vulnerability — regular patching eliminates the entire category of kernel exploit escalation paths.
Defence 03: Sudo policy review
Audit all sudo rules regularly. Remove NOPASSWD entries that are not operationally required. Never grant sudo access to interpreters (Python, Perl, Ruby), editors (vim, nano), or file transfer tools (wget, curl) without absolute necessity.
Defence 04: SUID binary auditing
Run periodic audits of SUID and SGID binaries using find / -perm -u=s. Remove the SUID bit from any binary that does not operationally require it. Cross-reference against GTFOBins to identify which binaries are exploitable.
Defence 05: Service hardening
Quote all Windows service executable paths. Review service ACLs to ensure low-privileged users cannot modify service binaries or configuration. Run services as low-privileged service accounts rather than SYSTEM where possible.
Defence 06: Credential hygiene
Never store credentials in config files, environment variables, or history files in plaintext. Use secret management tools. Rotate service account passwords regularly and audit all locations where credentials may be cached or stored on disk.
For blue teams and system administrators. Run linPEAS and winPEAS against your own systems in an authorised internal assessment to see exactly what privilege escalation paths exist in your environment right now. These scripts are the same ones penetration testers use. Finding your own escalation paths before an attacker does is one of the highest-value proactive security activities any system administrator can perform.
Legal and ethical requirement. All privilege escalation techniques described in this guide are for use exclusively in authorised penetration testing engagements, certified training lab environments such as TryHackMe and Hack The Box, and proactive internal security assessments with written management approval. Attempting privilege escalation on any system without explicit written authorisation is illegal under computer misuse legislation globally.
Frequently asked questions about privilege escalation
What is GTFOBins, and how does it relate to privilege escalation?
GTFOBins (gtfobins.github.io) is a curated list of Unix binaries that can be used to bypass local security restrictions in misconfigured systems – specifically when those binaries have been granted SUID permissions or sudo access without appropriate restriction. For each binary, GTFOBins documents exactly how it can be abused to read files, write files, spawn shells, or perform network connections at elevated privilege levels. During a privilege escalation assessment, penetration testers cross-reference every SUID binary and sudo-allowed command found on the system against GTFOBins to identify which ones have documented abuse techniques. The equivalent resource for Windows is LOLBAS (Living Off The Land Binaries And Scripts).
What is the difference between linPEAS and manual privilege escalation enumeration?
linPEAS (Linux Privilege Escalation Awesome Script) is an automated enumeration tool that checks hundreds of known privilege escalation vectors in seconds — sudo rules, SUID binaries, writable directories, cron jobs, kernel versions, stored credentials, and more – colour-coded by severity. Manual enumeration involves running each check individually using native Linux commands and requires knowing exactly what to look for. Both approaches are used in professional penetration testing. linPEAS provides broad, rapid coverage to identify the most promising vectors quickly. Manual enumeration follows up on specific findings with deeper investigation and custom validation. The OSCP exam rewards candidates who understand both approaches rather than relying entirely on automated tools.
Which certifications test privilege escalation skills most thoroughly?
Privilege escalation is one of the most heavily weighted skills in the OSCP (Offensive Security Certified Professional) – the exam explicitly requires candidates to demonstrate privilege escalation on multiple machines to achieve full marks. The PWK course dedicates entire chapters to both Linux and Windows privilege escalation methodology. The CEH (Certified Ethical Hacker) covers privilege escalation in its system hacking module with specific questions on techniques and tools. The eJPT (eLearnSecurity Junior Penetration Tester) is the best beginner certification for hands-on privilege escalation practice. TryHackMe has dedicated privilege escalation learning paths for both Linux and Windows that are widely used for OSCP preparation.

