VulnHub drone-SkyTower

VulnHub drone-SkyTower

Download address: https://www.vulnhub.com/entry/skytower-1,96/ After
downloading the drone, open it under VirtualBox, and configure the network card as a bridge.
Task: Elevate privileges and obtain the flag

Environment: both the
attacker and the target are in the 192.168.8.0 segment.
Attacker: kali linux 192.168.8.108


1. Information collection

To infiltrate the target machine, we must first know what the IP of the target machine is. We first use nmap to detect the surviving host.
Command: nmap -sP 192.168.8.0/24

Insert picture description here

After knowing that the IP of the target machine is 192.168.8.109, continue to use nmap to scan the open ports of the target machine.
Command: nmap -A -p- 192.168.8.109
Insert picture description here
detects that the target machine has opened ports 22, 80, and 3128, of which port 22 is filtered, and port 3128 is a proxy port. It is guessed that the proxy needs to be turned on to access port 22 of the target machine .

Visit port 80 first.
Insert picture description here
Seeing the login box, the first reaction is SQL injection, bp captures the packet and clicks to send it in the repeater.
Insert picture description here
Login failed, as expected, add a single quote after the first admin.
Insert picture description here
In the sql error report, there is an extra single quotation mark, add a comment after admin' # to
Insert picture description hereprompt login failure, that is to say, this position is the injection point, try the universal payload to crack the password
Insert picture description here11# and the following statement report an error, continue to try order by the number of blasting fields.
Insert picture description hereder and the following statement report an error, combined with the previous error, the guess or is filtered. Use || instead of or to continue trying the universal payload.

Insert picture description hereSuccessfully logged into the webpage. And it shows that the password of account john is hereisjohn.
Insert picture description hereAs mentioned before, it is guessed that port 3128 of the proxy target is required to access port 22. Here, proxytunnel is used to set up a proxy server tunnel. After proxy, the designated access ip is 127.0.0.1, port is 22, and the listening port is 8888. Insert picture description here
Insert picture description here
Then visit port 22 of the target machine.
Insert picture description hereYou can see that the login has been successful, but the connection was closed immediately, and it prompts Funds have been withdrawn. Now that you are logged in, try to execute the command directly.
Insert picture description here
View the catalog.
Insert picture description here
View .bashrc.
Insert picture description here
You can see that ssh is closed because of the configuration of .bashrc, delete this file and log in to ssh.
Insert picture description here
You can see that you have successfully logged in. sudo -l Check whether sudo can be used to escalate the privileges. If
Insert picture description here
it is not possible, enter /var/www to see login.php.
Insert picture description here
Remember the sql injection on the login.php page, the php file will contain the user name and password of the database, go to login.php to view it.
Insert picture description hereIt can be seen that the password of the root user is also root, and the database is SkyTech, enter mysql to view.
Insert picture description hereThe passwords of the three users are known to us, and the second user can check it first.
Insert picture description here
This is the sentence again, repeat the previous steps to enter Sara with ssh.
Insert picture description hereViewing sudo -l,
Insert picture description hereyou can see that the sara user is allowed to use the sudo command cat or any file in the ls /accounts directory.

Second, right escalation

Insert picture description here
Find the accounts directory here, and use the sudo ls command to view the contents.
Insert picture description here
Finally, use the sudo cat command to view the flag.txt file and obtain the root password theskytower.
Insert picture description here
The right escalation was successful, and the drone has been completed so far.

Guess you like

Origin blog.csdn.net/Slow_/article/details/114132416