February 13, 2021

Hack the Box Lame room

The initial NMAP scan results had ports for FTP, SSH, SMB and a new one that I didn't know what it was. Port 3632 has a service of distcc and come to find out it is a program to distribute compilation of C or C++ on a network.

# Nmap 7.91 scan initiated Sat Feb 13 15:21:59 2021 as: nmap -sV -sC -Pn -p- -oA nmap/server2
Nmap scan report for
Host is up (0.11s latency).
Not shown: 65530 filtered ports
21/tcp   open  ftp         vsftpd 2.3.4
|_ftp-anon: Anonymous FTP login allowed (FTP code 230)
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      vsFTPd 2.3.4 - secure, fast, stable
|_End of status
22/tcp   open  ssh         OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)
| ssh-hostkey: 
|   1024 60:0f:cf:e1:c0:5f:6a:74:d6:90:24:fa:c4:d5:6c:cd (DSA)
|_  2048 56:56:24:0f:21:1d:de:a7:2b:ae:61:b1:24:3d:e8:f3 (RSA)
139/tcp  open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp  open  netbios-ssn Samba smbd 3.0.20-Debian (workgroup: WORKGROUP)
3632/tcp open  distccd     distccd v1 ((GNU) 4.2.4 (Ubuntu 4.2.4-1ubuntu4))jo
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Host script results:
|_clock-skew: mean: 2h36m19s, deviation: 3h32m08s, median: 6m18s
| smb-os-discovery: 
|   OS: Unix (Samba 3.0.20-Debian)
|   Computer name: lame
|   NetBIOS computer name: 
|   Domain name: hackthebox.gr
|   FQDN: lame.hackthebox.gr
|_  System time: 2021-02-13T16:30:38-05:00
| smb-security-mode: 
|   account_used: <blank>
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
|_smb2-time: Protocol negotiation failed (SMB2)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Sat Feb 13 15:25:00 2021 -- 1 IP address (1 host up) scanned in 180.55 seconds

So, now it is time to see if there is an exploit that I can use to target that specifically. After going to Google I found one that is in metasploit.

I tried those specific commands and the terminal kept saying that I needed to set a payload. To list payloads in metasploit use the command show payloads. I tried a couple of them but this one cmd/unix/reverse worked.

Once I got onto the box I find out that I am the daemon user in the /tmp directory. Now it's time to see what I can do to try and get the user flag that I know is on this box. After exploring the file system the flag that I am looking for is located in /home/makis. Now that I have found the user flag time to go and try to find the root flag.

After a while of trying to search the system for a vulnerability for privilege escalation I decided to search for vulnerabilities in the other ports that were open. The ftp service had a vulnerability that I could find in Google but I can't get the exploit to work. So, it is now onto searching for a vulnerability in the SMB service. Time to go to Google and see what I can find for Samba 3.0.20-Debian, which is what NMAP displayed for the version of the SMB server. The first thing that pops up is a Rapid7 article about an exploit.

The exploit that I want to use, according to Rapid7 is:

Again, I made sure to set a payload that allowed me to get a shell on that machine. I then ran the exploit and found out that I am root on the machine. I then navigated to the correct folder to get the root flag for the machine. Once I had the root flag I submitted it and then finished the room.

As always, please send comments and suggestions about my posts to [email protected]. Have a great day and happy hacking.