Blunder, a Linux box created by HackTheBox user egotisticalSW is an easy rated box.The Initial foothold was finding a username is todo.txt and brute-forcing the password with the wordlist created from the blog posts.Using metasploit we can get a shell as www-data and then finding a user.php which contain a password hash for user. Cracking the hash an using su we can get the user. Checking sudo -l we see we can run /bin/bash as different user and not root, and the version of sudo was Sudo version 1.8.25p1 which have a CVE using which we can get root.
Enumeration
nmap
1 2 3 4 5 6 7 8 9 10 11 12 13
# Nmap 7.80 scan initiated Sun May 31 01:00:46 2020 as: nmap -sC -sV -T4 -oN nmap/scan 10.10.10.191 Nmap scan report for 10.10.10.191 Host is up (0.36s latency). Not shown: 998 filtered ports PORT STATE SERVICE VERSION 21/tcp closed ftp 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) |_http-generator: Blunder |_http-server-header: Apache/2.4.41 (Ubuntu) |_http-title: Blunder | A blunder of interesting facts Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Sun May 31 01:02:06 2020 -- 1 IP address (1 host up) scanned in 79.95 seconds
hugo@blunder:~$ sudo -l MatchingDefaults entries for hugo on blunder: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User hugo may run the following commands on blunder: (ALL, !root) /bin/bash hugo@blunder:~$
we can run /bin/bash to any user but root
also checking sudo -V shows us that
1 2 3 4 5 6 7
hugo@blunder:~$ sudo -V sudo -V Sudo version 1.8.25p1 Sudoers policy plugin version 1.8.25p1 Sudoers file grammar version 46 Sudoers I/O plugin version 1.8.25p1 hugo@blunder:~$
this is a version of sudo which is vulnerable to CVE-2019-14287 about which i had also written here
while doing the box i got in the rabbit hole after getting www-data. I saw /ftp folder and got that folder and was looking in that if that could get us user.