Page cover

THM Basic Pen-Testing Machine

Target IP Address

10.10.142.239

Nmap Scan Report

So there are lots of open Ports so we can enumerate one by one some of these are used to gain an initial foothold.

Web server Enumeration

Hidden Directory Scan

This hidden directory has some text that gives us clue that there are two users one name starts with j and the other user's name starts with k also they give us a clue one of the users has a weak password.

SMB Enumeration

Using Nmap smb enumeration scripts we found the following shares

The above Result shows that we have guest user share with anonymous access.

by Enumerating the smb with the Nmap smb-users-enum script or metasploit module or some other techniques we found these valid users.

Using Smb we found Two user

  1. Jan

  2. kay

Now we have valid users so we can use brute forcing to try to get these users' ssh passwords as they have ssh service open. In the web server enumeration stage, we know one of them has a weak password so we can use hydra to bruteforce the user's password

Hydra Bruteforce Result

Using Brute force we found a valid user password

Now we have the jan user password so we ssh to the machine to get the foothold using the command

Now we have initial access to the system so now we use the other post-exploitation techniques to get more privileges. We can use the linpeas script to find privilege escalation vectors. The linpeas shows that the kay user has an ssh private key that is readable to the Jan user so we can read it and copy all the content of that key to our attacking machine change the permission of that key so that only you can read it with the following command

This will change the permission of the key to read/write only for you so now you can ssh to the kay user with that key using the following command

This command is used to ssh to that target machine with the private key of the kay user. So by running the above command we have found that this key is protected by a password so which means we also need a password to login.

So digging for the password we can use the sshtojohn script to get that private key password hash that is understandable to John the Ripper tool.

This will create the hash file of the key and store it in the kay_rsa.hash file now we use John to crack the hash or to get the password

This will crack the password using the wordlist rockyou.txt

Using Bruteforce with John we found the user kay ssh key password

So now we have the ssh key password so we can use it to get access to the kay user

And this is the final password we found after successful login

Last updated

Was this helpful?