Post

Write-up / Elevator Dockerlabs.

Write-up exploiting a File Upload vulnerability, Sudoers Privilege Escalation.

Write-up / Elevator Dockerlabs.

Download vulnerable target machine: Elevator - Dockerlabs.es

Discovery.

Ports scannig.

nmap -p- -Pn -sS --min-rate 5000 --open <IpAdress> img-description Open ports: 80

Version scan
img-description

We can go to see what is the target hosting on port 80. img-description

There’s a button that execute an script to open the elevator, but nothing else happens.

Directory Fuzzing.

As I couldn’t find anything interesting I tried to fuzz the server to search other interesting directories.

1
ffuf -u <TargetURL/<FUZZ>> -w <wordlist> [OPTIONS]

img-description img-description

I found /themes but I don’t have permission to acces the resource. That’s not a problem, those permissions are not allways recursive so we can continue fuzzing to see if we can acces other directories contained in themes.
For the next scan I will try to search for files so I will add a lot of extension using the -e paramether.

img-description

We have achieved a lot of interesting directories: img-description /uploads

img-description /archivo.html

archivo.html -> We can use it to upload .png.
uploads -> May contain the images that we upload to archivo.html.

Exploitation.

Let’s try to exploit the target using the previous information.

File Upload.

In a File Upload vulnerability we need to hide a malicious file to cheat the server and execute it.
I will use pentestmonkey - phpReverseShell.
We have to modifie the payload to point to our local host: img-description

Now it’s time to upload our file, the file must be .jpg, so we will change our payload name before. img-description

img-description

We will use nc to open a port to establish the reverse shell.

nc -nlvp <ListenPort> img-description

img-description

Post Exploitation.

Lateral Movement 1.

I will use linpeas.sh to scan the target and find vulnerabilities. img-description

img-description

Sudoers Privilege Escalation.

linpeas found the following vulnerability, we can go to gtfobins to see how to elevate our privileges. img-description

img-description

img-description

Lateral Movement 2.

img-description

img-description

img-description

Lateral Movement 3.

img-description

img-description

Lateral Movement 4.

img-description

img-description

Lateral Movement 5.

img-description

Privilege Escalation.

img-description

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