Basic Pentesting
This is a machine that allows you to practice web app hacking and privilege escalation
Last updated
This is a machine that allows you to practice web app hacking and privilege escalation
Last updated
Try this challenge in TryHackMe: Basic Pentesting
In doing this challenge, I learned the following skills and tools:
brute forcing - using hydra
hash cracking - using ssh2john, john
service enumeration - using nmap, gobuster
Linux Enumeration - using enum4linux, linpeas
Run nmap and save it in basicpentest directory
Just change the 10.10.X.X
to the IP address assigned to your target machine
Check it in the browser: http://10.10.X.X
Try to View Page Source
. There is a note in green there to check their dev note section.
So let's check if there is a /dev
directory.
We get Not Found responses from both paths, but we can see information disclosure in the responses that are worth noting.
Apache/2.4.18 (Ubuntu) Server at 10.10.X.X Port 80
Using gobuster let's try to figure out what directories are available to the server.
Even without finishing the scan, we get the directory /development
.
When we access the directory, we'll see two text files, dev.txt
and j.txt
. Let's open both.
We found users jan
& kay
via enum4linux
Using hydra, we now know the password
Now that we know jan’s credentials, we used them to log in via SSH
Check folders and see if we can find interesting files
Since most actions led to denied permissions, we ran linpeas in the machine to check possible privilege escalation methods.
To copy linpeas.sh
to the machine in the /dev/shm
folder:
Check if the linpeas file is transferred successfully
Make linpeas executable:
Then execute linpeas:
From the linpeas results, we found private SSH keys in the path /home/kay/.ssh/id_rsa
Open the id_rsa file then copy the contents
In your Kali machine, paste the contents into a file named kay_id_rsa
Change the permissions of the file to read-writable only by you
Try logging in to the machine using the user Kay’s id_rsa
We find that a passphrase is needed for this file.
To figure out the passphrase for kay’s id_rsa, we used ssh2john in the JohnTheRIpper module
We need to save this in a text file to be decrypted via john
Using john, we decrypted the file and got the passphrase
We can now log in using kay’s credentials
We opened the pass.bak file and then the password was revealed