STDIN/STDOUT
if we can copy stdin to a file and to stdout we can use these techniques to gain root privilege on linux. this can be done with a vulnerable binary that doesn't correctly handle I/O.
Scenario #1
add an entry to the β/etc/crontabβ file which is executed every minute to change the permissions fro the β/bin/shβ binary to be 4777 which means SUID.
if the vulnerable binry file is called teehee, we will have something like this:
this means that the vulnerable binary run the echo command and add the line to /etc/crontab which will run every minute and gives us full access to /bin/bash as root
Scenario #2
adding an entry the /etc/passwd file for a new user called βhackingresourcesβ with the same uid (User ID) and gid (Group ID) as root user and this user has no password.
again we are using the same vulnerability with a different method.
Scenario #3
by adding an entry to the /etc/sudoers file which will allow jim user to run all the commands as root without the need for the password.
Last updated