3.8 KiB
HackTheBox-Spectra
NMAP
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.1 (protocol 2.0)
| ssh-hostkey:
|_ 4096 52:47:de:5c:37:4f:29:0e:8e:1d:88:6e:f9:23:4d:5a (RSA)
80/tcp open http nginx 1.17.4
|_http-server-header: nginx/1.17.4
|_http-title: Site doesn't have a title (text/html).
3306/tcp open mysql MySQL (unauthorized)
8081/tcp open blackice-icecap?
| fingerprint-strings:
| FourOhFourRequest:
| HTTP/1.1 200 OK
| Content-Type: text/plain
| Date: Thu, 04 Mar 2021 16:38:15 GMT
| Connection: close
| Hello World
| GetRequest:
| HTTP/1.1 200 OK
| Content-Type: text/plain
| Date: Thu, 04 Mar 2021 16:38:14 GMT
| Connection: close
| Hello World
| HTTPOptions:
| HTTP/1.1 200 OK
| Content-Type: text/plain
| Date: Thu, 04 Mar 2021 16:38:25 GMT
| Connection: close
|_ Hello World
PORT 80 (HTTP)
![](https://imgur.com/aNXvip6.png)
Clicking on Test
or Softwaer Issue Tracker
would be leading us to http://spectra.htb
so let's add this to /etc/hosts
![](https://imgur.com/P0KY28k.png)
![](https://imgur.com/dLk6e3I.png)
![](https://imgur.com/FVrnLZC.png)
![](https://imgur.com/BTpBDp7.png)
![](https://imgur.com/FRtmiix.png)
Going to wp-config.php.save
we can find credentials to the database
![](https://imgur.com/VSRhiu9.png)
But when connecting to them it just doesn't allow
![](https://imgur.com/wjfH4dZ.png)
Wpscan
So we can't connect to mysql so we have a wordpress site let's run wpscan
on it
![](https://imgur.com/GomMYG0.png)
![](https://imgur.com/cAzWQxm.png)
So we have a wordpress user administrator
![](https://imgur.com/f4JfP4q.png)
Using the password devteam01
we logged in with administrator
![](https://imgur.com/faWVNps.png)
We can edit the 404.php
template in the active theme
![](https://imgur.com/h2DIC5A.png)
![](https://imgur.com/06A0v9C.png)
Using a metasploit payload
![](https://imgur.com/CvLoXLI.png)
![](https://imgur.com/bbYRLsM.png)
Add ssh public key in /home/nginx/.ssh/authorized_keys
![](https://imgur.com/Bp2ZWS3.png)
![](https://imgur.com/h0utHDJ.png)
Going in /opt
directory
![](https://imgur.com/aAXcFE8.png)
![](https://imgur.com/5tDMR1I.png)
We find a passwd
file
![](https://imgur.com/djoWHPT.png)
ssh as katie
![](https://imgur.com/j8iUIUL.png)
On doing sudo -l
we'll see what we can run as root
![](https://imgur.com/tULPcp6.png)
And we can run initctl
which is used for running services, these services are stored in /etc/init
We can see the services we can edit
![](https://imgur.com/OiPGXTo.png)
![](https://imgur.com/Ckviuh7.png)
Here this service is running a nodejs file which is nodetest.js
![](https://imgur.com/h2RowUK.png)
This is what we see when we visit port 8081 on the web browser we can edit this file by a node js reverse shell
![](https://imgur.com/U6XnnAj.png)
After editing set a netcat listener
![](https://imgur.com/xTP232M.png)