Usage (Easy)
Easy difficulty Linux box.....
Enumeration
As usual let's start with an nmap scan:
We see SSH and HTTP, so let's add
10.10.11.18 uasge.htb
to our hosts file and see the website.
We see that we can register, login or visit the admin section which takes us to admin.usage.htb
which we also need to add to our host file and check later.
After i made an account and logged in, there was only some short articles written on the website, with no useful information.
So i went to see the admin website, but it only had login and there was nothing i can do to bypass it, so i decided to get back to the main website and test for SQL injection, since i haven't on it.
Now trying in /forget-password
we see that when we send a single '
we get a server error:
So this indicates we might be able to do some SQL injection, so i fried SQLmap on it:
I intercepted the request with burp and saved it to a file called it forget-password.req
and used the following command:
Exploitation
This took a while and we found boolean based injection in the email field, and sqlmap retrieved the present databases on the system:
Now let's enumerate the usage_blog
database and see what can we get from it.
Doing that we will retrieve the tables in the DB, which one of them will be admin_users
which probably has passwords, so let's dump it using:
And we get a username of "admin" and his password hash! Let's start cracking.
Let's try logging in to that admin site we found earlier:
Wandering a little bit around, we see in the profile we can upload a profile picture, so lets try uploading a quick reverse shell:
So we changed the file extension to php, and the MIME type to "appliaction/php", and you see the content of "shell.php" so submitting the request then refreshing the profile page, we see a new picture.
Opening that file (via the link from the download) we get a response and a shell as the dash user.
Privilege Escalation
Enumerating a little bit, we see there is another user called "xander" and we see a password in
/home/dash/.monitrc
and trying it on that user, we succeed.
And now we have a shell as xander, let's see the sudo privileges we have:
So we see this is an executable file, so we upload it to our box, and checking it in ghidra, what's interesting is the backupWebContent
function:
So we create a file starting with "@" sign, and make a symbolic link to the file we want to read, now when 7z executes, it will treat the file "starting with @" as if it has a list of files it needs to work with, now since we linked it to /root/root.txt
it will read it, and say there are no files that it can process.
And we get our flag :D and for shell access, you can read an ssh key or something.
That's it for the box!
Last updated