Wednesday, July 31, 2013

For educational purposes only! I will not take responsibility for you!


In this post, I will be demonstrating how to root a Linux server with a shell uploaded to it. I will be moving step-wise that’s definitely going to bring out the best tutorial on Linux server rooting all over the web.


Assuming that I have already uploaded a shell on some website on the server with a change that specifies the attacker’s IP and the appropriate port as shown below:


1


 


Now, the attacker with the IP ‘192.168.48.189‘ starts listening for a connection through Netcat as:


2


 


Now, my shell on the server looks something like:


2_4


 


with several PHP backconnect links. As soon as I click on one of them, the terminal window which was listening for the connection, shows up like this:


2_5


 


Type uname to get the server version running as:


3


 


Cool, it’s 3.0.0-12-generic! The attacker googles for the version’s exploit by searching ‘Linux server 3.0.0-12-generic exploit‘ and gets one for him. In our case let it be ‘exploit.c‘


Now, traverse to the ‘/tmp‘ directory, which is always writable. Next, the attacker creates a custom directory there (say ‘exploit‘ ) as:


51


 


The attacker has successfully created the ‘exploit‘ directory and added the exploit.c file to it. Now, he needs to compile the exploit.c file and create an output file (say it to be ‘rooted‘) in the same directory. To do so, the attacker proceeds further like:


61


 


This is almost done. The attacker now changes the file permission of rooted to777 as:


8


 


Now execute the output file and done!


8_5


The attacker types ‘id‘ and he can see that he has successfully gained the root access to the server.


 

0 comments :

Post a Comment