Legacy
Machine Level: Easy OS: Windows
Scanning
I ran an aggressive NMAP script to determine the services and OS on the box.
ajread@aj-ubuntu:~$ nmap -A [TARGET IP]-Pn
Starting Nmap 7.80 ( https://nmap.org ) at 2023-01-21 15:55 EST
Nmap scan report for [TARGET IP]
Host is up (0.019s latency).
Not shown: 996 filtered ports
PORT STATE SERVICE VERSION
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 [LOCAL IP]
| 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.X - 4.X (workgroup: WORKGROUP)
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
Host script results:
|_ms-sql-info: ERROR: Script execution failed (use -d to debug)
|_smb-os-discovery: ERROR: Script execution failed (use -d to debug)
|_smb-security-mode: ERROR: Script execution failed (use -d to debug)
|_smb2-time: Protocol negotiation failed (SMB2)
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 57.81 secondsThere wasn't anything that I could find on ftp.
With the SMB scanner, I was able to determine that the version was Samba 3.0.20-Debian.
Initial Access
I searched for the version of Samba in metasploit and found an excellent module for usermap_script to complete RCE. According to Rapid7, specifying a username with shell meta-characters allows a user to run commands.
I set the appropriate inputs and ran the exploit in metasploit, which dropped me into a root shell!
I was able to read the user and root flags.
Last updated