Page cover

Sightless

Synopsis

Sightless is a easy linux machine created by EmSec. The nmap discovers the ftp, ssh and http open ports. The web has a sightless.htb domain. The subdomain sqlpad.sightless.htb uses the sqlpad and it is vulnerable to CVE-2022-0944 RCE vulnerability. The exploit gives us the foothold to docker container as root user. The shadow file contains the hash of root and michael user. Cracking the password gives us a shell of michael user via ssh. Pilliaging the michael we discovers that the froxlor is running using port 8080, admin.sightless.htb vhost is present in /etc/hosts file, the user john has enabled the chrome remote debugger and running the administrator.py. Port forwarding and adding the vhost into the /etc/hosts gives us a froxlor login page. The metasploit is used for chrome remote debugger exploit to download the administrator.py file. The file contains the crediantials for froxlor login page. The froxlor has a php-fpm service installed. Enable the service and we can copy the id_rsa of root user by configuring the new php version.

OS
Difficulty
Points
Release Date
Retired Date

Linux

Easy

20

07-09-2024

11-01-2025


Enumeration

Nmap

Started the nmap and found the ftp, ssh and http services running.

nmap -Pn -sC -sV --min-rate=500 10.10.11.32

Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-08 02:18 EST
Nmap scan report for 10.10.11.32
Host is up (0.88s latency).
Not shown: 964 filtered tcp ports (no-response), 33 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
21/tcp open  ftp
| fingerprint-strings: 
|   GenericLines: 
|_    220 ProFTPD Server (sightless.htb FTP Server) [::ffff:10.10.11.32]
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/
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=1/8%Time=677E26F3%P=x86_64-pc-linux-gnu%r(Ge
SF:nericLines,44,"220\x20ProFTPD\x20Server\x20\(sightless\.htb\x20FTP\x20S
SF:erver\)\x20\[::ffff:10\.10\.11\.32\]\r\n");
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: 1 IP address (1 host up) scanned in 111.49 seconds

Add the sightless.htb in /etc/hosts file.

Web - sightless.htb

The website is hosted for giving the services for handling the IT infrastructure. The sqlpad and froxlor is used for handling databases and servers services.

The start now button in service section of sqlpad redirects us to sqlpad.sightless.htb subdomain and the froxlor redirects to froxlor main page.

Add the sqlpad.sightless.htb in /etc/hosts file.

Web - sqlpad.sightless.htb

SQLPad is a web application designed to help users write, run and visualize SQL queries. It supports a variety of databases including Postgres, MySQL, SQL Server, and others via ODBC.


Foothold

Searching the vulnerability for sqlpad in web leads me to CVE-2022-0944 RCE vulnerability. The PoC blog post of these vulnerability is published in huntr.

Shell - Docker Container [root]

Add New Connection and choose MySQL Driver. In database section add the below payload.

Start the nc listener in your local machine and click on test.


Pivoting

Shell - Docker Container [root] -> michael

The shadow file in docker container gives us the password hash for michael and it can be used for pivoting to system as a michael.

Create the file., copy and paste both the hashes into the file. Crack the hash using hashcat.

circle-info

The hash in the above command is a name of a file which contains the hash.

circle-info

The user.txt file contains the user flag and we can read it 👏


Privilege Escalation

Pillaging - michael [user]

Michael doesn't have the privilage to run the sudo command. The netstat command lists us some of the open ports.

The port 8080 is used for hosting froxlor service. Port forward to local machine for further enumeration.

The /etc/hosts file has a admin.sightless.htb vhost for froxlor site. Add the admin.sightless.htb in your /etc/hosts file.

The ps aux command reveals that the user john has a chrome remote debugger activated which can be used to find the credentials for above login.

The user john is also running the below command.


Exploit - Chrome Remote Dubugger [Metasploit]

The exploit for chrome remote debugger is available in metasploit. I will be using it to download the administration.py file for getting the froxlor dashboard credentials.

  • Port Forward all the larger number ports.

  • Run the metasploit while adding all the ports until the administration.py file is downloaded

circle-info

The port numbers may be different. In my case port 41429 is used by chrome remote debugger.

The credentials for froxlor dashboard is admin:ForlorfroxAdmin

Shell - root

The php-fpm can be used for getting shell as root or reading the root.txt file.

  • Enable the php-fpm: System > Settings > PHP-FPM

  • Copy the root id_rsa file or root.txt.

  • Change directory into /tmp and cat id_rsa

  • Copy the id_rsa and save it into your local machine. Change the permission and ssh into root.

circle-info

The root.txt file contains the root flag 🎉

Last updated