When an ethical penetration tester or adversary initially exploits a web vulnerability (such as a file upload flaw or command injection), they rarely land on the target server as the root superuser or Windows NT AUTHORITY\SYSTEM. Typically, the initial shell executes inside an unprivileged service account (e.g. www-data or a restricted local user). Privilege Escalation (PrivEsc) is the systematic process of exploiting operating system misconfigurations, kernel bugs, or weak permissions to elevate from a restricted user to full administrative control.
The very first command an analyst executes upon catching a Linux shell is sudo -l, which lists what commands the current user can execute with root privileges:
# Check allowed sudo commands
www-data@target:~$ sudo -l
User www-data may run the following commands on target:
(ALL : ALL) NOPASSWD: /usr/bin/find
If a binary like find can run as sudo without a password, an attacker executes root commands via find's -exec flag:
sudo find . -exec /bin/sh -p ; -quit
# Output: # (You are now ROOT!)
Security researchers reference GTFOBins, an exhaustive curated database of Unix binaries that can be abused to bypass local security restrictions.
A binary with the SUID bit set (4000) executes with the permissions of the file owner (typically root) rather than the user running it:
# Search for all root SUID binaries, discarding error output
find / -perm -4000 -user root -type f 2>/dev/null
| Vulnerability | Misconfiguration Mechanism | Exploitation Path |
|---|---|---|
| Unquoted Service Paths | A Windows Service binary path contains spaces and is not wrapped in quotes (e.g. C:\Program Files\My Service\app.exe). |
Windows interprets spaces as potential executable extensions. An attacker drops a malicious binary at C:\Program.exe; upon reboot, the service executes it as SYSTEM! |
| AlwaysInstallElevated | Windows Registry keys AlwaysInstallElevated set to 1 in both HKLM and HKCU. |
Allows standard users to install Windows MSI packages with SYSTEM rights. Attacker generates a malicious MSI payload via msfvenom. |
| Token Impersonation (SeImpersonatePrivilege) | Service accounts (like IIS APPPOOL or LOCAL SERVICE) possess the SeImpersonate privilege. |
Exploited via the "Potato" family of tools (JuicyPotato, SweetPotato) to trick a local RPC service into authenticating and elevating to SYSTEM. |
Penetration testers automate local enumeration using industry-standard auditing scripts:
Broaden your defensive and offensive security knowledge across our curriculum:
Post-exploitation tactics to turn a low-privileged shell into full administrative control.
Adversary TTPs for elevating privileges on Linux servers and Active Directory.
Mitigating SUID and capability abuses through unprivileged user namespaces.
Hands-on lab finding misconfigured Sudoers rights and SUID binaries in Linux.