Sitemap
Half blood prince

Half blood prince

Press enter or click to view image in full size

Kenobi [THM — writeup]

5 min readJun 29, 2024

--

Question 1 :

Press enter or click to view image in full size

open Your Vpn in kali linux .

using nmap command for open ports

nmap — open <MACHINE IP>

Press enter or click to view image in full size

Here we can see the open ports .

ANSWER: 7

Enumerating Samba for shares

Press enter or click to view image in full size

using command Given
“nmap -p 445 — script=smb-enum-shares.nse,smb-enum-users.nse 10.10.250.110”

Press enter or click to view image in full size

we can see we got 3 shares

ANSWER: 3

Press enter or click to view image in full size

using Command “smbclient //10.10.250.110/anonymous”

Press enter or click to view image in full size

When it ask for a password Just enter.(Although its a bad practice leaving no password on the machine)

as we can see the answer is the txt file

ANSWER:log.txt

Press enter or click to view image in full size

using the first nmap -open command we know ftp is on 21 port

ANSWER: 21

as we cant open log.txt so we will download it to our working machine
usually it downloads in root directory

Press enter or click to view image in full size

now opening it we got

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

now THM is giving us a Hint for port 111 with RPC
USing “nmap -p 111 — script=nfs-ls,nfs-statfs,nfs-showmount 10.10.250.110”
WE got

ANSWER: /var

TASK 3 Gain initial access with ProFtpd

Press enter or click to view image in full size

NOW we know FTP port is 21 so using simple nc with machine

Press enter or click to view image in full size

hence
ANSWER: 1.3.5

Press enter or click to view image in full size

NOW, using searchsploit proFTPd

Press enter or click to view image in full size

ANSWER: 4

Here, the txt file seems something easy to have a look lets give a try
using: searchsploit -m <PATH>

Press enter or click to view image in full size

In the log.txt it is mentioned where the user’s id_rsa key is located:

Get Half blood prince’s stories in your inbox

Join Medium for free to get updates from this writer.

“Your identification has been saved in /home/kenobi/.ssh/id_rsa”

Based on the exploit we found earlier: “File copy — 36742.txt”

Press enter or click to view image in full size

reviously we enumerated port 111, and found out that we could see the /var directory.

Next, we will set the destination file

using the command: SITE CPTO /home/kenobi/.ssh/id_rsa

Next, we will set the destination file using the commands:

SITE CPTO /var/tmp/id_rsa

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Currenty “/var/tmp” is our attacking Machine Directory

So

Press enter or click to view image in full size

using Commands which are given

we copied the id_rsa

Press enter or click to view image in full size

Using chmod 600 on the copied

Press enter or click to view image in full size

then connecting ssh
Command: ssh -i <file name> kenobi@<MACHINE IP>

Press enter or click to view image in full size

ANSWER: d0b0f3f53b6caa532a83915e19224899

Task 4Privilege Escalation with Path Variable Manipulation

Press enter or click to view image in full size
Press enter or click to view image in full size

THM tells us to look for one that looks not ordinary. That would be “/usr/bin/menu”as it does not look like a command that an admin would be familiar with.

ANSWER: /usr/bin/menu

Press enter or click to view image in full size
Press enter or click to view image in full size

ANSWER: 3 (options)

Press enter or click to view image in full size

THM is suggesting using Strings Command to find readable text
SO..

Press enter or click to view image in full size
Press enter or click to view image in full size

we will create create a file named curl having /bin/sh

Press enter or click to view image in full size

Changing its permission to 777
by chmod 777 <file name>

Press enter or click to view image in full size

I added this path to PATH variable on the first position and now theoretically when choosing option number 1 (the one that calls curl command) we should get shell with root permissions.

ANSWER: 177b3cd8562289f37382721c28381f02

Press enter or click to view image in full size

END

--

--