• We just launched and are currently in beta. Join us as we build and grow the community.

Pwned-1: Vulnhub Walkthorugh

Deighton254x

Innovator
Divine
D Rep
0
0
0
Rep
0
D Vouches
0
0
0
Vouches
0
Posts
174
Likes
71
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
Today we are going to solve another boot2root challenge called “Pwned: 1”. It’s available at Vulnhub for penetration testing. This is an easy level lab.The credit for making this lab goes to Ajs Walker. Let’s get started and learn how to successfully break it down.

Level: Easy

Since these labs are available on the Vulnhub website so we will download the lab file from here.

Penetration Testing Methodology

Recognition

  • Netdiscover
  • Nmap

Enumeration

  • Gobuster

Exploiting

  • Obtaining SSH private key backup

Privilege Escalation

  • Abuse of sysadmin script.
  • Abuse of Docker Group privileges
  • Capture the flag

Walkthrough

Recognition

As always, we identify the host’s IP with the “Netdiscover” tool:

Code:
netdiscover

1.png


Now start by listing all the TCP ports with the help of Nmap.

Code:
nmap –sV -sC -P- 192.168.10.192

2.png


To work more comfortably, I’ll put the IP address in /etc/hosts.

3.png


Enumeration

Now, we have entered the web service and found information about the hacker “Annlynn” in the body and commented lines of the source code.

4.png


We have used Gobuster with a medium directory dictionary, indicating the typical extensions.

5.png


We will access the directory “/hidden_text” and will find a file named as “secret.dic“, this contains a directory listing.

After checking with Gobuster, we saw that only the directory “/pwned.vuln” is available.

6.png


Exploiting (user “Ariana”)

We found an administration panel exposed, after trying the typical passwords to try to access and not succeed, we went to check the source code and found that there is a condition in PHP with some credentials. The user already gave us the clue for which service to use (FTP).

7.png


We connect to the FTP service with the obtained credentials, we find an SSH private key for the user “Ariana” and a note.

8.png


Now we have changed the permissions to the file “id_rsa” and connect through SSH with the user “Ariana“. Once inside, we can read the first flag.

9.png


Privilege Escalation (user “Selena”)

We execute the command “sudo -l“, evidencing that we are able to execute a script called “messenger.sh” as the user “selena”. If we check the code, we can verify that it executes the information in “
$msg 2> /dev/null
“. Given this, we could insert a “
/bin/bash
” so that it raises a shell with the user we have previously indicated in the script.

10.png


We start the script…

We indicate the user “selena“, type “
/bin/bash
”… That’s right! We have obtained a shell with this user, we read the 2nd flag.

11.png


Privilege Escalation (root)

We type “id” and list that we belong to the group “Docker“, then we check the docker images that we have available and execute the command that will allow us to escalate privileges with a shell as root.

Finally, we will read the flag.

Code:
docker run -v /:/mnt --rm -it privesc chroot /mnt sh

12.png


Author: David UtĂłn is Penetration Tester and security auditor for Web applications, perimeter networks, internal and industrial corporate infrastructures, and wireless networks Contacted on LinkedIn and Twitter.
 

432,073

312,529

312,538

Top