DMV:1 - Walkthrough [Vulnhub]

Here's my solution for DMV:1
The machine can be downloaded from here.

Nmap
Scanning for all TCP ports.
$ nmap -sC -sV -p- 192.168.1.104


We find 2 ports open.

Enumeration
Since port 80 (HTTP) is open, let us browse the web.

Observing the web page, seems like it converts the youtube video to mp3 file.
Why not provide any randon value and check.


On the other hand we scan for directories using dirb.
$ dirb http://192.168.1.104/ -r


Interesting, browsing /admin, ask for authentication. At this point tried brute-forcing the password with default user as admin. But no result.

We browse the main page again, provide randon value and intercept the request. And check the request and response.


We see an error in reponse, we can easily search for the error to get an idea what it is all about or related with. 

While searching about the error we came across this github page, after going through it we navigated to code section from issues section.

We can see the source code of the application which is written in python.

We go through the documentation and check the list of available flags.

Let us put the value as- --help, and check the response.
And we see that its working file.


Lets us try one more time with other flag (--version).

Seems its working absolutely fine.
As we have a flag --exec, which executes a command, we try it.

We try to execute, id command, but did not get the expected output.

By using the special character less than symbol (<) and backtick (`) we are able to execute the command successfully.

We try to execte the ls -la command, but did not work. Seems to be an issue with space.

After some searches we firgured out a way. We replace the space with ${IFS}.
And this time we are able to execute the command successfully.

Getting Access
Now we upload the python reverse shell using netcat.


 



On the other hand we start the netcat listener.



We successfully get the reverse shell.

User Flag.
We get the flag under /var/www/html/admin directory.



Privilege Escalation
We transfer pspy32 on the target machine under /tmp directory.

We give full permission to the file, and we execute it. Observering the output we find that a file named- check.sh, runs as root every 1 minute.

We navigate to directory- /var/www/html/tmp where the file- check.sh is located.


We simply place the bash reverse shell payload in file and on the other hand we start the netcat listener.


We know that the file runs every 1 minute, we wait for a minute and we get the reverse shell succesfully.

Root Flag.


 

Comments

Popular posts from this blog

Sunset:Noontide - Walkthrough [Vulnhub]

CyberSploit:2 - Walkthrough [Vulnhub]

BBS(cute):1.0.1 - Walkthrough [Vulnhub]