Let's think about it this way for a second
Privilege escalation is the process of an attacker taking their initial low-privilege access and trying to escalate to higher privilege (admin/root). There are two types: vertical escalation (low-privilege user → admin/root, e.g. exploiting a misconfigured sudo permission) and horizontal escalation (moving from one user's privileges to another's — same privilege level, but broader access). Misconfigurations (weak file permissions, unnecessary sudo access, outdated software) are the common cause of privilege escalation — defenders can only reduce this risk by following the least privilege principle (giving users only the permissions they actually need).
Let's connect it to a real-world scenario
After logging into a lab VM with a low-privilege user account, run the `sudo -l` command — this shows you which commands the user is allowed to run with root permission. If you find a misconfigured entry (say, a text editor that's been given root permission), you can use that text editor to escalate to a root shell. You can consult GTFOBins (a public reference site) to learn which commands can be used for escalation.
Let's look at it together
# Check what commands your current user can run as root
# (a common early step after gaining a low-privilege shell)
sudo -l
# Example misconfiguration:
# (ALL) NOPASSWD: /usr/bin/vim
# -> vim can be used to spawn a root shell, since it can
# execute OS commands from within the editorUser user1 may run the following commands on this host:
(ALL) NOPASSWD: /usr/bin/vimTry it in 5 minutes
Run `sudo -l` on a lab VM (your own lab only) and check out the GTFOBins website — read up on how a misconfigured command (vim, find, less, and the like) can be used for privilege escalation.
A quick word of caution
Only practice GTFOBins and other privilege escalation techniques in an authorized lab — even on your own production systems (even if you're the system admin), follow proper change management processes before making any permission changes.