Starting with nmap to determine what ports are open and what services are running.
Full command and result of scanning:
On port 80 we have a web page. But at this point we can’t really do anything with it, as we don’t have credentials: simple passwords do not work, no interesting directories.
But if we look closely on result of nmap, we can see subdomain that we can check out.
Add ip address and staging.love.htb to /etc/hosts and access subdomain from browser.
So we have some File Scanner functionality, but firstly we need to register. Just put some fake data and move on.
After registration we are redirected to page beta.php. Basically, we can put some url and page will print content of page. Usually in this type of functinality we will check for lfi/rfi and ssrf.
RFI won’t work here as any content of file will be represented only as text.
So we can try SSRF with Burp Intruder by inputting http://127.0.0.1:§port§ and setting payload as range of numbers from 1 to 10000, for example.
And we have local port on this machine with some web page, which stores credentials for previously visited voting system:
admin: @LoveIsInTheAir!!!!
User
Log in using admin credentials.
Here we will usually look for file upload to upload our shell. After examining the functionality, we can upload pictures when we create entry about candidate.
So here our steps to upload shell.
1) Create position to further assign it for candidate:
2) Generate shell using command:
3) Create entry about candidate and attach shell as image:
4) Received shell is not stable as wished. Generate .exe shell and upload using received reverse shell.
5) Receive stable user shell
Privilege escalation
We can run PowerUp.ps1 script to automate the post-enumeration process.
Download it from our machine with command:
Access powershell:
Load script and run checks:
So we can prove that we have AlwaysInstallElevated using commands:
To exploit we can execute these steps:
1) Generate .msi
2) Upload
3) Install malicious .msi
4) Receive admin shell
Rooted
That’s it for this machine. Stay safe and Happy Hacking!