Cheat Sheet :: Privilege Escalation
Using scripts to enum the machine
https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS
On the target’s machine we can do:
| |
Nano privilege escalation
- This can be used to gain root access on the server.
| |
- Nano allows inserting external files into the current one using the shortcut.
| |
/pics/nano-001.png
- The command reveals that we can execute system commands using ^X (Press Ctrl + X) and enter the following command to spawn a shell.
| |
/pics/nano-002.png
- Now we have a root shell. /pics/nano-003.png
Sudo privilege escalation
Listing allowed sudo commands
| |
Impersonating with sudo
| |
Escalating privileges with find command
| |
Escalating privileges with vim editor
| |
Escalating privileges with less command
- Open a file using less
| |
- Inside the less we can call a shell
| |
Escalating privileges with awk command
| |
Escalating privileges with chmod
- Create the exploit to call a command
| |
- Compiling the exploit
| |
- Setting the setuid and setgid flags
| |
Escalating privileges with perl
| |