HackTheBox / Easy
Sightless
Tested by:
Testing performed by Nikolay Kravtsov, a beginner information security specialist at 16:13 (very simple room, I advise beginners!)
Testing scope and services used.
| IP/domain | Port | Service | Target Server Service |
|---|---|---|---|
| localhost | 5901 | WinKexServer | - |
| localhost | - | Nmap Port Scanner | - |
| localhost | - | GoBuster Directory Scanner | - |
| localhost | - | Obsidian Notes | - |
| localhost | 8000 | Python HTTP Simple Server | - |
| localhost | - | john the ripper hash cracker | - |
| 10.10.11.32 | 80 | Web Server + SQLPad Web Server | + |
| 10.10.11.32 | 22 | SSH | + |
Files used:
- linpeas.sh - Privilege Escalation Awesome Scripts SUITE new generation.
- sqlpad-rce-exploit-CVE-2022-0944 - Remote Command Execution in SQLPad 6.10.0.
- userpass.txt - a file containing password hashes from /etc/shadow for cracking.
- rockyou.txt - the largest wordlist of passwords for a Brute Force attack attempt.
- user.txt - flag.
- root.txt - flag.
Procedure
1) Launch openvpn for access; kex to make Linux more convenient
kex --win && sudo openvpn lab_Kolya080808.ovpn2) Scanning ports using nmap.
Results:
21/tcp open ftp
| fingerprint-strings:
| GenericLines:
| 220 ProFTPD Server (sightless.htb FTP Server) [::ffff:10.10.11.32]
| Invalid command: try being more creative
|_ Invalid command: try being more creative
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 c9:6e:3b:8f:c6:03:29:05:e5:a0:ca:00:90:c9:5c:52 (ECDSA)
|_ 256 9b:de:3a:27:77:3b:1b:e1:19:5f:16:11:be:70:e0:56 (ED25519)
80/tcp open http nginx 1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://sightless.htb/
|_http-server-header: nginx/1.18.0 (Ubuntu)
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port21-TCP:V=7.94SVN%I=7%D=11/17%Time=6739DBD3%P=x86_64-pc-linux-gnu%r(
SF:GenericLines,A0,"220\x20ProFTPD\x20Server\x20\(sightless\.htb\x20FTP\x2
SF:0Server\)\x20\[::ffff:10\.10\.11\.32\]\r\n500\x20Invalid\x20command:\x2
SF:0try\x20being\x20more\x20creative\r\n500\x20Invalid\x20command:\x20try\
SF:x20being\x20more\x20creative\r\n");
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
3) Launch gobuster to search for directories.
- Results:
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://sightless.htb
[+] Method: GET
[+] Threads: 10
[+] Wordlist: directory-list-2.3-medium.txt
[+] Negative Status codes: 404,302
[+] User Agent: gobuster/3.6
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/images (Status: 301) [Size: 178] [--> http://sightless.htb/images/]
Progress: 9643 / 220561 (4.37%)^C
[!] Keyboard interrupt detected, terminating.
Progress: 9653 / 220561 (4.38%)
===============================================================
Finished
===============================================================
4) We didn’t get anything interesting, so let’s look at the site:
- Result:

5) We look around at the found site:
Result:

6) We try to use the found exploit:
Result:
Pretty fast!7) Since we are root, we can try to read /etc/shadow:
Result:
root@c184118df0a6:/var/lib/sqlpad# id
id
uid=0(root) gid=0(root) groups=0(root)
root@c184118df0a6:/var/lib/sqlpad# cat /etc/shadow
cat /etc/shadow
root:$6$jn8fwk6LVJ9IYw30$qwtrfWTITUro8fEJbReUc7nXyx2wwJsnYdZYm9nMQDHP8SYm33uisO9gZ20LGaepC3ch6Bb2z/lEpBM90Ra4b.:19858:0:99999:7:::
daemon:*:19051:0:99999:7:::
bin:*:19051:0:99999:7:::
sys:*:19051:0:99999:7:::
sync:*:19051:0:99999:7:::
games:*:19051:0:99999:7:::
man:*:19051:0:99999:7:::
lp:*:19051:0:99999:7:::
mail:*:19051:0:99999:7:::
news:*:19051:0:99999:7:::
uucp:*:19051:0:99999:7:::
proxy:*:19051:0:99999:7:::
www-data:*:19051:0:99999:7:::
backup:*:19051:0:99999:7:::
list:*:19051:0:99999:7:::
irc:*:19051:0:99999:7:::
gnats:*:19051:0:99999:7:::
nobody:*:19051:0:99999:7:::
_apt:*:19051:0:99999:7:::
node:!:19053:0:99999:7:::
michael:$6$mG3Cp2VPGY.FDE8u$KVWVIHzqTzhOSYkzJIpFc2EsgmqvPa.q2Z9bLUU6tlBWaEwuxCDEP9UFHIXNUcF2rBnsaFYuJa6DUh/pL2IJD/:19860:0:99999:7:::
8) Cracking Michael’s password hash:
Result:

9) Log in as user Michael and read user.txt
Result:

10) Let's download linpeas and see what we can do:
Result:

11) Honestly, I was shocked, but this ssh key was enough to increase privileges and get root.txt:
Result:

Note:
This room is too simple. I think it’s better for me to go through medium rooms, not easy))
But anyway, thanks to HackTheBox for the speedrun room!!!
Vulnerabilities found
Information Disclosure
PoC:
(point 11)
CVSSv3 Score: 10.0 (Critical)
Description:
Here, information disclosure results from other users being able to access /root and read root’s SSH key. That exposed key lets them log in as root.
Reproducing the vulnerability:
(point 10)
Remediation recommendations:
- Restrict user access to the /root directory.
- Store ssh keys in a folder that is inaccessible to all users.
- If possible, do not use ssh keys for users, but simply log into the server using a password.
CVE-2022-0944
PoC:
(point 6)
CVSSv3 Score: 10.0 (Critical)
Description:
This exploit allows remote execution of commands on the server without the knowledge of the administrator.
Reproducing the vulnerability:
(point 5)
Remediation recommendations:
- Restrict access to this website page.
- Update sqlpad to latest version.
BruteForce
PoC:
(point 8)
CVSSv3 Score: 7.5 (High)
Description:
Michael’s weak password can be recovered by cracking its hash, allowing SSH access.
Reproducing the vulnerability:
(point 8)
Remediation recommendations:
- Change your password.
- Do not use passwords from the rockyou wordlist.
Use a password generator to create passwords that do not appear in common wordlists.
Video walkthrough