Post

Write-up / Apolos Dockerlabs.

Write-up exploiting SQLI vulnerabilty, after accessing to the admin panel we make a file upload attack.

Write-up / Apolos Dockerlabs.

Download vulnerable target machine: Apolos - 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 The target is an apple store.

Directory Fuzzing.

While I make a manual enumeration of the site I like to fuzz the server recursively:

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

img-description

I found interesting directories like /themes and uploads, I will keep them in mind because we may need them in the future.

Fuff found other interesting resourcess like a login page.

img-description


Manual web Enumeration.

SQLI Detection.

The server has a functionality to show the apple products, this type of fields are allways interesting to try to execute a SQLI. img-description Sadly the server had sanitization for the characther ‘`’ so I couldn’t execute the attack. img-description img-description img-description

Register and Login.

The next step was to register and then try to login and see if we are able to use more functionalities. img-description img-description

image

After login we still have a ‘search’ function, but this time seems a bit diferent, if we try the SQLI again the results are different. img-description img-description

Exploitation.

SQLI

You can acces to the next Tutorial to explore how to execute the SQLI attack.

img-description img-description img-description img-description img-description img-description img-description

img-description img-description

Admin password dump via SQLI succes.

img-description

Once we have obtained the hashes it’s time to decrypt them, I like to use crackstation.net.

img-description

Now it’s time to login as the admin user and check what’s inside the Admin panel. img-description

File Upload.

In the admin panel we can go to ‘adm_configuration.php’, where we will see a file upload function. Let’s try to exploit it.
To do so I will use the php-reverse-shell from pentestmonkey.net.
img-description

We can not upload .php files. Let’s try to change the extension and upload the payload again. img-description

  • I tried to change the extension to .png and the script didn’t work.
  • After that we can try the different types of php extensions.

img-description

Once the payload is uploaded we will go to /uploads, we found this directory in the fuzzing phase. Before opening the file we have to run nc -nlvp <PORT>

img-description


Post Exploitation.

Lateral Movement 1.

Su Brute Force Attack.

I used linpeas.sh to scan the target and find vulnerabilities but it was unsucesful.

In this scenario I like to try a brute force to the system users su Brute Force Attack.(You can find the script we are using in this repo.)

  1. We can acces to /etc/passwd to see which users exists in the system and try to brute force them.
  2. To do so I use the rockyou.txt password dictionary.

img-description img-description

Password detected.
img-description

Privilege Escalation.

Now it’s time to run linpeas.sh back and see what can we find. img-description img-description As we can see in the previous images our current user is on the group shadow so we can read /etc/shadow file.

unshadow.

You can acces to the next Tutorial to explore how to execute the unshadow PE. attack.

img-description

img-description

img-description

img-description img-description



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