Basic Pentesting 2 Walkthrough
Basic Pentesting 2 Walkthrough
Basic Pentesting 2 Walkthrough
me back, fellow hackers! I finally had time to play with another CTF. Back in March, I already wrote
a walkthrough for the first part of the Basic Pentesting CTF and really enjoyed playing it. If you
haven’t already, you should definitely do that first. They released the second part of it a while back
Search …
and I chose to do it as well, so here you can read my Basic Pentesting 2 Walkthrough, another
awesome CTF that I highly recommend to beginners!
Over the past couple months, my hacking skills got a bit rusty because I needed to work a lot with
Amazon Web Services and general Firewall Security. This new CTF was a great refresher and
sparked my interest again in doing more CTFs. But enough of this, let’s get started! 💌 Newsletter
You can download the VM here. I used VirtualBox to import it and it worked from scratch. I use Email address:
Sign up
Networking
VirtualBox Host-Only Subnet: 192.168.56.0/24
pfSense (32)
Productivity (1)
Programming (8)
Python (1)
React (1)
Reviews (12)
ReviewsFeatured (4)
Sysadmin (41)
The Bug Bounty Diaries (11)
Tutorials (1)
Web Development (7)
After identifying my own host with the IP of 192.168.56.102, I run a Nmap simple ping scan to
identify the Basic Pentesting 2 VM.
I use the db_nmap command to directly store the scan in my Metasploit basicpentesting2
workspace/database.
We see open ports, services and service numbers. Although we were not able to find out the OS
version with this scan (yet). Because we used the db_nmap command within Metasploit, we can
now easily get an overview of open services by running:
services
This is one of the reasons why I really like to stay within the Metasploit framework.
If I access that same link with the port 8080 on the end, I reach the Apache Tomcat Configuration
Page -> http://192.168.56.101:8080
This might or might not be useful, if I try to access the Manager App or Server Status, I get
prompted for a password.
Running Dirb against http://192.168.56.101 reveals the /development page. Let’s check that out.
dirb http://192.168.56.101/
/development/dev.txt
/development/j.txt
There are two users, J and K. J apparently has a weak password. We also learned that J is using an
older version of Apache. Probably J is our entry point in the network. Now we need to find out
what their username is.
I used the tool enum4linux for user enumeration. It is pre-installed on Kali but not on Parrot. If
you are on Parrot, you can easily install it like this:
sudo -i
cd /opt/
cd /enum4linux/
chmod +x enum4linux.pl
Once installed, I enumerated SSH users with the command below. On Kali, you just need to type
enum4linux 192.168.56.101.
./enum4linux.pl 192.168.56.101
This is using the – a option per default, meaning it’s running all its basic checks. If you scroll
through the results you can find a couple of interesting things. If you just want to enumerate for
usernames, you could use the -U option.
Turns out, J is jan and K is kay. Great, now I got their usernames.
If you haven’t used the rockyou.txt wordlist before, you have to first unzip it.
Now you could go about this multiple ways. You could use the Metasploit module
auxiliary/scanner/ssh/ssh_login, or, you can use the probably much faster tool: Hydra.
ssh jan@192.168.56.101
And I am in! Turns out they run Ubuntu 16.04.4 (4.4.0-119). Before googling exploits for that
specific version, I dig around a bit.
ls -la
Whereas:
ls /home/
Reveals not only Jan’s but also Kay’s user folder. A further dig into Kay’s folder reveals a file called
pass.bak.
But there is something else of interest. A hidden folder called .ssh. In there I locate an id_rsa file.
This sounds interesting, probably an ssh key.
cd /home/kay/.ssh
cat id_rsa
Before starting to Bruteforce the file with John The Ripper, I needed to convert the file so that
John can read it:
john privatekeyjohn
And sure enough, I am in! This should enable me to read the pass.bak file that I have seen earlier
in Kay’s home folder. After that, I copied that password and logged in with root.
cat pass.bak
sudo -i
Conclusion
This concludes the Basic Pentesting 2 Walkthrough. It was extremely educational to dig around
and use that Private Key for gaining access to Kay’s account. I had a great time solving this and it
didn’t take me too long. The hardest part for me was to figure out what to do with the Private Key
file. I am already looking forward to the next Basic Pentesting CTF!
Please Share!
Cyber Security
Basic Pentesting 2 Walkthrough, CTF
Install Zabbix on Ubuntu 18.04: Easiest & Fastest Way!
Install Grafana on Ubuntu 18.04 using AWS EC2
This site uses Akismet to reduce spam. Learn how your comment data is processed.