Linux privilege Escalation using the SUID Bit
If you have a executable file running root command.
rws-rwx-rwx root root
Example of a vulnerable program
Exploitation
Creating a file which spawns a shell when executed:
Allowing other users to execute the file:
Adding our malicious program’s directory to the PATH variable so our malicious file gets located first:
If you want to, you can check the contents of the PATH variable like this:
Now all we have to do is run the vulnerable SUID executable, and we will have root!
Source
(https://materials.rangeforce.com/tutorial/2019/11/07/Linux-PrivEsc-SUID-Bit/)[https://materials.rangeforce.com/tutorial/2019/11/07/Linux-PrivEsc-SUID-Bit/]{ .md-button }