HTB : https://app.hackthebox.com/machines/1
Write up : https://0xdf.gitlab.io/2020/04/07/htb-lame.html
Machine IP : 10.129.20.110
Recon
Nmap
Starting with a port scan, nmap find 4 open ports.

ftp version is VSFTPD 2.3.4. ftp use ftp default user and anonymous user.

FTP - TCP 21
ftp/ftp account login. but directory was empty.

vsftpd 2.3.4 is Backdoor exploit.

msfconsole start. search for vsftpd.
I’ll use it, and set the target:

set rhosts 10.129.20.110. but The exploit failed to land us a shell.

SMB
SMB Anonymous login
smbmap null session login.
tmp share folder have READ, WRITE access.

smbclient null session login success.

smbclient use -N option(Anonymous login option) and read tmp share folder. but do not see anything of interest:

Foothold
MSFConsole
Samba smbd version is 3.0.20-debian

Privilege Escalation
searchspolit search samba 3.0.20-debian. (CVE-2007-2447)
This module exploits a command execution vulnerability in Samba versions 3.0.20 through 3.0.25rc3 when using the non-default “username map script” configuration option. By specifying a username containing shell meta characters, attackers can execute arbitrary
commands. No authentication is needed to exploit this vulnerability since this option is used to map usernames prior to authentication.

MSFConsole execute and search samba 3.0.20. find exploit /samba/usermap_script module.

set RHOSTS 10.129.20.110(HTB Target Machine) and set LHOST tun0(VPN IP)

Exploit, landing us a shell on the target system as the root user.

get user flag for makis user’s home directory.

get root flag.
