Kenobi for TyHackMe Writeup.
Room Name Kenobi

This room [Kenobi On TryHackMe] will cover accessing a Samba share, manipulating a vulnerable version of proftpd to gain initial access and escalate your privileges to root via an SUID binary.
Objective of room
This room will cover
- Accessing a Samba share
- Manipulating a vulnerable version of proftpd to gain initial access
- Escalate privileges to root via an SUID binary.
Nmap
AS always i start with nmap to scan for open ports and services in this machine.
nmap -sS -sC -sV -A 10.10.194.61
Result
1 | |
33 We got ssh on port 22 and ftp on port 21 and http on port 80 and rpcbind on port 111 and smbd on port 139 & 445
SMB Enumeration
**nmap -p 445 –script=smb-enum-shares.nse,smb-enum-users.nse 10.10.194.61 **
1 | |
We have
1 | |
Try to connect with SMB via anonymous
smbclient \10.10.194.61\anonymous
1 | |
we get log.txt it has sensitive information
path of ssh id_rsa → /home/kenobi/.ssh/id_rsa
rpcbind Enumeration
we have rpcbind service running on port 111
nmap -p 111 –script=nfs-ls,nfs-statfs,nfs-showmount
1 | |
We have var Directoy and know the FTP version ProFTPD 1.3.5
Go to exploit-db and search for exploit or use Searchsploit
We have File Copy
Connect to FTP via nc on port 21
1 | |
now we will copy the ssh id_rsa from /home/kenobi/.ssh/id_rsa to /var/tmp/
1 | |
go and make folder like H3X0S3
mount 10.10.194.61:/var /H3X0S3
1 | |
Use id_rsa to connect to ssh
1 | |
Time for some privilege escalation
SUID
(Set owner User ID up on execution) is a special type of file permissions given to a file. Normally in Linux/Unix when a program runs, it inherits access permissions from the logged in user.
Use
ind / -type f -perm -u=s 2>/dev/null
to search for files with a misconfigured SUID let us to get root privileges
1 | |
The /usr/bin/menu file looks intersest. Let’s run this binary. we get this output with 3 options to select:
1 | |
In 1. status check like curl.
we make can file and name it as curl and copy /bin/bash to it then make it readable, writeable and executable then add the path of curl file to bash shell of the system path
1 | |
Search for root flag
1 | |
