November 18, 2026
TryHackMe Basic Pentesting β Complete Walkthrough | Nmap, Web Enumeration, SMB, SSH & Credentialβ¦
Introduction

By Muhammed Ameen S
8 min read
Introduction
In this walkthrough, I'll document my approach to completing the Basic Pentesting lab on TryHackMe.
This challenge focuses on Linux enumeration, network reconnaissance, web directory discovery, SMB enumeration, SSH credential assessment, and private-key analysis.
I'll follow the same sequence used during my lab session, explaining the commands, analysing the results, and documenting each important stage with terminal screenshots.
The objective is to understand how seemingly small security misconfigurations can expose sensitive information and potentially lead to unauthorized account access.
Lab Environment
ComponentDetailsPlatformTryHackMeAttacker machineKali LinuxTarget machineBasic PentestingTarget IP10.49.141.68Operating systemUbuntu LinuxToolsNmap, Gobuster, Enum4linux, Hydra, SSH, John the Ripper
All activities described here were performed in an authorized lab environment.
1. Initial Reconnaissance β Nmap
The first step in any penetration-testing assessment is identifying the services exposed by the target machine.
I started by running an Nmap scan with service-version detection and additional enumeration enabled.
nmap -sV -A 10.49.141.68nmap -sV -A 10.49.141.68Command breakdown:
-sVβ Identifies service versions running on open ports.-Aβ Enables OS detection, version detection, default script scanning, and traceroute.
Scan Results
The scan identified six open ports:
PortServiceVersion22SSHOpenSSH 8.2p180HTTPApache 2.4.41139NetBIOSSamba445SMBSamba8009AJP13Apache JServ8080HTTPApache Tomcat 9.0.7
One interesting observation was that the target exposed multiple services, including SMB and Apache Tomcat.
This provided several potential areas for further investigation.
Instead of immediately attempting exploitation, I decided to enumerate each service and understand what information it exposed.
2. Web Enumeration β Apache Web Server
After identifying Apache running on port 80, I opened the target IP address in the browser.
http://10.49.141.68/http://10.49.141.68/The homepage displayed the following message:
Undergoing maintenance. Please check back later.
At first glance, the website did not appear to contain any useful information.
However, a maintenance page does not necessarily mean that the web server has no accessible resources.
I decided to inspect the page source.
Interestingly, the HTML source contained a comment mentioning a development notes section.
This gave me a direction for further enumeration.
3. Directory Discovery Using Gobuster
To identify directories and files that were not directly linked from the homepage, I used Gobuster.
gobuster dir -u http://10.49.141.68/ -w /usr/share/dirb/wordlists/common.txtgobuster dir -u http://10.49.141.68/ -w /usr/share/dirb/wordlists/common.txtCommand breakdown:
dirβ Enables directory and file discovery mode.-uβ Specifies the target URL.-wβ Specifies the wordlist used for enumeration.
Enumeration Results
Gobuster identified several paths:
.hta (403)
.htaccess (403)
.htpasswd (403)
development (301)
index.html (200)
server-status (403).hta (403)
.htaccess (403)
.htpasswd (403)
development (301)
index.html (200)
server-status (403)The most interesting discovery was:
/development//development/The HTTP 301 response indicated that the server redirected the request to the directory path with a trailing slash.
I opened the directory in the browser and discovered an Apache directory listing.
4. Analysing Development Files
Inside the /development/ directory, I discovered two text files:
dev.txt
j.txtdev.txt
j.txtThese files contained internal development notes.
4.1 Analysing dev.txt
The first file contained notes about the Apache setup, SMB configuration, and experimentation with Apache Struts.
One particularly interesting detail was a reference to:
Apache Struts 2.5.12Apache Struts 2.5.12The developer mentioned experimenting with the REST example application and considering hosting it on the server.
This information was useful because it revealed details about the software being explored in the development environment.
It also demonstrated how exposed development notes can disclose information that is useful during security assessments.
4.2 Analysing j.txt
The second file contained a message directed towards another user.
The note mentioned that the developer had been auditing the /etc/shadow file and had successfully cracked the user's password hash.
It also requested that the user change their password because it did not follow the organization's password policy.
This was an important clue.
It suggested that weak credentials might be another security issue worth investigating.
5. SMB Enumeration Using Enum4linux
The next service I investigated was SMB.
During the initial Nmap scan, I identified SMB-related services on ports 139 and 445.
To gather more information, I used Enum4linux.
enum4linux -a 10.49.141.68enum4linux -a 10.49.141.68Command breakdown:
enum4linuxβ A tool used to enumerate information from SMB services.-aβ Enables the available comprehensive enumeration checks.10.49.141.68β Specifies the target IP address.
Enumeration Results
The output revealed several interesting details:
- Workgroup name: WORKGROUP
- NetBIOS name: BASIC2
- Samba server information
- Local user information
- Local group information
Another important observation was that the server allowed sessions using an empty username and password.
This indicated that anonymous SMB enumeration was possible.
5.1 Discovering Local Users
Further enumeration through RID cycling revealed three local user accounts:
kay
jan
ubuntukay
jan
ubuntuThese usernames became important for the next stage of the assessment.
The discovery demonstrated how SMB enumeration can reveal useful account information even without successfully authenticating as a normal user.
6. SSH Credential Assessment Using Hydra
The earlier Nmap scan confirmed that SSH was running on port 22.
Additionally, the development note had provided a clue that one of the users had a weak password.
Based on the information gathered during enumeration, I decided to investigate the SSH authentication security of the discovered jan account in the authorized lab.
I used Hydra with the RockYou wordlist.
hydra -l jan -P /usr/share/wordlists/rockyou.txt ssh://10.49.141.68hydra -l jan -P /usr/share/wordlists/rockyou.txt ssh://10.49.141.68Command breakdown:
-l janβ Specifies the username being assessed.-Pβ Specifies the password candidate list./usr/share/wordlists/rockyou.txtβ The password wordlist.ssh://10.49.141.68β Specifies the SSH target.
Result
Hydra identified a valid credential combination for the jan account.
This confirmed that the account was using a password present in the tested wordlist.
The finding demonstrated how weak passwords can expose SSH accounts to password-guessing attacks.
7. Initial Access Through SSH
After validating the lab credentials, I attempted to establish an SSH connection.
ssh jan@10.49.141.68ssh jan@10.49.141.68The first connection prompted me to verify the target's SSH host key.
After accepting the host key and authenticating with the discovered lab credential, the connection succeeded.
The server displayed the Ubuntu login banner:
Welcome to Ubuntu 20.04.6 LTSWelcome to Ubuntu 20.04.6 LTSI now had an authenticated shell as the user jan.
This marked an important transition from external enumeration to post-authentication investigation.
8. Exploring the User Environment
After obtaining access, I started inspecting the user's home directory.
I used:
ls -lals -laThe output showed the contents of the current user's directory, including hidden files.
I also checked the current working directory:
pwdpwdThe output confirmed that I was working inside:
/home/jan/home/janNext, I investigated another user's SSH directory.
cd /home/kay/.sshcd /home/kay/.sshThe directory was accessible from the current lab session.
I listed its contents:
lslsThe output revealed three important files:
authorized_keys
id_rsa
id_rsa.pubauthorized_keys
id_rsa
id_rsa.pubThe id_rsa file immediately caught my attention because it was an SSH private key.
9. SSH Private Key Discovery
I inspected the private-key file:
cat id_rsacat id_rsaThe output showed that the file contained an encrypted RSA private key.
The header included:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTEDThis confirmed that the private key was protected using a passphrase.
Although encryption provides additional protection, an exposed private key can still create a serious security risk if its passphrase is weak.
I decided to perform an offline password-strength assessment against the key within the lab environment.
10. Preparing the Private Key for Password Auditing
Before attempting the offline assessment, I copied the lab key into my local working environment.
I used a text editor to prepare the key file.
nano id__rsanano id__rsaAfter saving the file, I restricted its permissions:
chmod 600 id__rsachmod 600 id__rsaThis ensures that the private key is readable and writable only by its owner.
The next step was converting the SSH key into a format suitable for John the Ripper.
I used SSH2John:
ssh2john id_rsa > crack.txtssh2john id_rsa > crack.txtCommand explanation:
ssh2johnβ Converts supported SSH private-key material into a John-compatible hash representation.id_rsaβ The encrypted private key.-
β Redirects the output into a file.
crack.txtβ The generated hash file.
The generated file could now be used for offline password auditing.
11. Offline Passphrase Assessment Using John the Ripper
With the hash file prepared, I used John the Ripper and the RockYou wordlist.
john --wordlist=/usr/share/wordlists/rockyou.txt crack.txtjohn --wordlist=/usr/share/wordlists/rockyou.txt crack.txtJohn processed the SSH private-key hash and identified a matching passphrase from the supplied wordlist.
To display the result, I used:
john --show crack.txtjohn --show crack.txtThe output confirmed that one password hash had been successfully recovered.
This demonstrated that the encrypted private key was protected by a passphrase that was present in a commonly used password list.
The important security lesson is that encrypting a private key is not enough if the passphrase protecting it is weak.
12. SSH Authentication Using the Discovered Private Key
After completing the offline passphrase assessment, I returned to the SSH authentication process.
I attempted to connect using the discovered private key:
ssh -i id_rsa kay@10.49.141.68ssh -i id_rsa kay@10.49.141.68The SSH client requested the key's passphrase.
After providing the recovered lab passphrase, the authentication succeeded.
The server displayed the Ubuntu login banner again, this time establishing a session as:
kaykayThis confirmed that the exposed private key could be used to authenticate as the associated account.
It also demonstrated how several security weaknesses can combine:
- A private key was accessible to another user.
- The key was encrypted with a weak passphrase.
- Offline password auditing recovered the passphrase.
- The key enabled authentication as the associated user.
13. Post-Authentication Investigation β Discovering pass.bak
After obtaining access as kay, I started inspecting the user's home directory.
I listed the available files:
lslsThe output revealed an interesting file:
pass.bakpass.bakThe filename suggested that it might contain previously saved password information.
I inspected the file:
cat pass.bakcat pass.bakThe contents revealed a password-like string.
This was another important security finding.
Backup files are often overlooked during security assessments. If they contain credentials or other sensitive information, they can become an additional source of account compromise.
I have intentionally redacted the actual secret from this article.
14. Security Analysis β What Did We Discover?
Throughout this lab, several security weaknesses were identified.
FindingSecurity impactExposed development directoryInformation disclosureAnonymous SMB sessionsUnauthenticated information gatheringWeak SSH passwordAccount compromise riskAccessible SSH private keyPrivate-key exposureWeak private-key passphraseOffline passphrase recoverySensitive backup fileCredential disclosure
The most important observation was that the attack path did not depend on one complicated vulnerability.
Instead, multiple smaller security weaknesses contributed to the overall exposure.
Recommended Remediation
- Disable unnecessary Apache directory listing.
- Remove internal development notes from publicly accessible directories.
- Restrict anonymous SMB access.
- Enforce strong and unique SSH passwords.
- Protect private keys with strong passphrases
- Restrict access to users' SSH directories.
- Avoid storing plaintext credentials in backup files.
- Rotate any exposed passwords and SSH keys.
- Monitor authentication logs for suspicious activity.
- Regularly audit Linux file permissions.
Conclusion
The Basic Pentesting lab was a useful practical exercise in understanding Linux enumeration and credential security.
I started with network reconnaissance using Nmap, identified exposed services, and continued with web directory discovery using Gobuster.
The development notes provided useful information about the environment, while SMB enumeration revealed local user accounts.
Further investigation demonstrated weak SSH authentication and exposed private-key material.
By using Hydra for authorized SSH password assessment and John the Ripper for offline private-key passphrase auditing, I was able to establish access as two different local users and identify an additional sensitive backup file.
The biggest lesson from this exercise is that information disclosure, weak authentication, and poor secret management can combine to create a significant security risk.
A proper penetration test is not simply about finding vulnerabilities. It is about understanding how those vulnerabilities connect, demonstrating their impact safely, and providing practical recommendations to prevent similar issues.
Keep learning. Keep practising. Hack ethically.