First run up Nmap and got two ports open , that is port 80 and port 8080 , and I answer the question, asking about ports.
Decided to open port 80 on my browser and it gave out apache server homepage :
Now I open up , the other port 8080 , which is a proxy , and it redirects me to https://ip/gallery/
which has a login page:
So on the login page, I try SQLi with the payload : admin ' or 1=1 limit 1-- +'
and I was able to login as administrator :
Looking around the dashbord I found an upload field on the profile settings, so I uploaded the file captured the request , and then edited the file contents , to a simple web shell:
And now time to pop shell :
Now that I have shell, I decided to look for configuration files, and I found config.php
but it was importing files from another folder:
I was able to find DBConnection.php
from classes
folder and it had the following:
which means the values of those variables are at initialize.php
I was able to get mysql creds , and $dev_data
information which seem to be creds for the developer , and there was the username and password as hash, I was able to answer number three by login to mysql and then copying the hash for admin!
First thing I did, was to update the shell, so as it doesn't give those shell errors :
I was able to update the shell, and as I was checking through /var/backups
I was able to see a user's backup folder mike
, so I read the history, and I was able to get the password:
I log in:
and there I got the user flag!
I first run sudo -l
and I got to see what commands can mike
run as root
:
I read the file /opt/rootkit.sh
:
From that code we can see when we choose the option read
we get to run nano which means we can use nano for privilege escalation:
I can easily get root shell here by typing the following:
and from here now I can type:
Set a listener on your terminal and boom you have root shell:
And we have the flag:
contact : tahaafarooq