Appsanity

Recon

nmap_scan.log

HTTPs (443)

HTTP redirects to HTTPs

Writeup.png

We can sign up as Patient.

Writeup-1.png

Passive recon of subdomain enumeration returned nothing for HTTP, but there's subdomain for HTTPs

Our token

Writeup-2.png

Become Doctor

When we sign up we have hidden field attached to form called Acctype which by default is 1, changing to 0 doesn't create account and 2 is Doctor.

Writeup-3.png

Now we are a Doctor

Writeup-4.png

When we try to add ourselves (patient account) in request we are ID of 7, changing ID doesn't show anything in response.

Writeup-5.png

Portal

Let's visit the subdomain

Writeup-6.png

The login urls are somewhat same and in the requests we don't have cookies from main domain to this domain. If we go back to main domain, change the access_token domain scope to .meddigi.htb (note the dot) we will get this cookie on all subdomains.

Writeup-7.png

Go back to the portal, refresh and voila! We are logged in as Doctor.

Writeup-8.png

Upload Bypass

https://portal.meddigi.htb/examreportarrow-up-right let's us upload files, but only PDFs.

During upload we can add magic bytes to detect this file as PDF

Writeup-9.png

And we get Examination report sent to the management.

Run passive recon to find where it gets uploaded ; Nothing interesting

SSRF

Meanwhile in Prescriptions we have SSRF

Writeup-10.png

Port 80 has response after ages... but all others have delay of 2 seconds.

We can filter by time

Writeup-11.png

SSRF to RCE

Looks like we can view reports, but our is long gone. Im actually going to change the payload to straight up reverse shell because interactive session doesn't look that bright.

Reverse Shell (svc_exampanel)

Upload -> SSRF on 8080 -> https://portal.meddigi.htb/ViewReport.aspx?file=5c7b8af3-70d9-4d94-bcfd-4fcd5dc4ca98_shell.aspxarrow-up-right -> Change protocol, url and port => http://127.0.0.1:8080/ViewReport.aspx?file=5c7b8af3-70d9-4d94-bcfd-4fcd5dc4ca98_shell.aspxarrow-up-right -> Get reverse shell

User.txt

Privilege Escalation (devdoc)

Decompile the DLL https://www.decompiler.com/jar/7d19edcf2760481892228654a92d724b/ExaminationManagement.dllarrow-up-right

It's getting some kind of decryption key from registry

Writeup-12.png

This looks like a password.

Get the users

Brute the password with wirnm, smb was not open.

WinRM

Enumerate with winpeas

There's something running on port 80 by ReportManagement, which lives in Program Files

Privilege Escalation (Administrator)

We only have access to ReportManagement.exe

From the strings if we had to make a rough guess, it's probably loading DLLs from C:\\Program Files\\ReportManagement\\Libraries

Writeup-13.png

The directory is empty and we have write access to it.

netcat was dying on evil-winrm and not letting me to interact with program, plain reverse shell was also dying so I had to port forward.

Scratch the filename, it seems as long as DLL is in the folder then it can be loaded. I messed up the filename, so externalupload2 worked too.

Writeup-14.png

Root.txt

Last updated