Lame Writeup

Lame was the first box released on HTB (as far as I can tell). It’s a super easy box, easily knocked over with a Samba version exploit to a root shell.

System Vulnerable: 10.10.10.3

Vulnerability Explanation: The MS-RPC functionality in smbd in Samba 3.0.0 through 3.0.25rc3 allows remote attackers to execute arbitrary commands via shell metacharacters involving the SamrChangePassword function, when the "username map script" smb.conf option is enabled, and allows remote authenticated users to execute commands via shell metacharacters involving other MS-RPC functions in the remote printer and file share management.

Vulnerability Fix: These vulnerabilities are addressed in Samba version 3.0.25. In addition, patches are available to address this vulnerability in Samba version 3.0.24. Refer to the Samba Security Releases website for more information.

Privilege Escalation Vulnerability: NONE

Vulnerability Fix: NONE

Severity: Critical

An initial nmap scan revealed a Samba as smbd 3.0.20-Debian version.

FTP (21/tcp)

FTP Anonymous login is enabled , but no file / folder is shared.

Samba (445/tcp)

Using smbclinet , list all available services on the server.

Using the searchsploit tool, search for any public vulnerability related to samba 3.0.20 :

Reading the Samba 3.0.20 < 3.0.25rc3 - 'Username' map script' Command Execution (Metasploit) exploit, and then use the same methodology to exploit the samba vulnerability.

Access to the shared disk (tmp) using smbclient .

Launch a local nc listener on the local machine and execute the exploit as the follow:

On this step, enter any password.

A reverse shell is received as user root :

For further step, we can spawn shell using python as the following to make the shell more readable.

Proof - User

Proof - Root

Hardening Tip

Change the value of guest ok = yes to guest ok = no on /etc/samba/smb.conf as the following

  • smb.conf before the change

  • smb.conf after the change

If we try to access the server as we did before as NT_STATUS_ACCESS_DENIED message is shown:

Last updated