Hack The Box — Blocky Walkthrough

Barry Malone
5 min readMay 1, 2021

--

Like a lot of people I am starting off my OSCP prep by running through TJnull’s OSCP HTB/Vulnhub VM list and doing each box without Metasploit, third Linux box on the list is Blocky.

Hack The Box Blocky

This was a pretty easy machine, if you have ever exploited WordPress config then gaining a foothold should be easy enough, there is a twist that might be tricky to catch if you have not been burned by it before.

Recon

I kicked off my recon process using AutoRecon, as always super helpful and saves a lot of time.

There is a small number of ports open when we check out the full TCP scan results:

Hack The Box Blocky Full TCP Scan NMAP

First I took a look at port 21 running the ProFTPD service, after quickly attempting anonymous and guest logins that both failed, I ran all of the nmap ftp scripts against the host which also did not reveal anything of use:

Hack The Box ProFTPD Blocky

I had a dig around at some of the ProFTPD 1.3.5 remote exploits but none of them were applicable or just didn't work with the version running on the target.

From here I moved on to taking a look at the web server running on port 80, this looked to be a WordPress site :)

Hack The Box Blocky Homepage Wordpress

After checking out the site itself there was not much in the html source of the page so I fired up dirsearch and tried to uncover any interesting directories:

Hack The Box Blocky dirsearch Results

Some notable directories are the PhpMyAdmin and Plugins, I made a note of these and then ran WPscan against the site which did not reveal any major plugin vulns but username enumeration did reveal something:

Hack The Box Blocky WPscan Username Enumeration

From here I tried to get into the PhpMyAdmin panel using basic root password attempts which all failed, from here jumping to the Plugins directory we found we can see that there are a couple of jar files on there:

Hack The Box Blocky Plugins Web Directory

We pull them down and fire up jd-gui to take a look at the source code and find what seem to be DB creds:

Hack The Box Blocky JD-GUI Source Code

Exploitation

Using the discovered credentials I am able to gain access to the PhpMyAdmin panel:

Hack The Box Blocky PhpMyAdmin Login Page

After taking a quick look around I jumped to the WordPress database and namely the wp_users table, from here I tried to recover the Notch user accounts password but it was salted & hashed:

Hack The Box Blocky wp_users Table

I decided to insert my own admin user into the database (using this article, it was rather simple):

Hack The Box Blocky Insert User
Hack The Box Blocky SQL Insert User

note — make sure the user_pass db field is at least set to MD5 or you will not be able to log in:

Hack The Box Blocky MD5 Password Field

And then apply the admin perms:

Hack The Box Add Administrator Permissions Wordpress Database

From here I was able to log in with the newly created WordPress administrator account.

I quickly started netcat and grabbed a WordPress reverse shell plugin from here:

Hack The Box WordPress PHP Reverse Shell Plugin Source Code

From here I zip the plugin and upload it to the WordPress site:

Hack The Box WordPress PHP Reverse Shell Zip

We activate the plugin which should execute the PHP and give us a reverse shell:

Hack The Box WordPress PHP Reverse Shell Plugin Upload and Activate

Meow:

Hack The Box WordPress Plugin Netcat Reverse Shell

After taking a look around we can see that there are only pretty much two users on the system, root and notch.. I see the user flag in the notch directory and could not access it.

Hack The Box Notch User Account
Hack The Box Notch Home Directory

I had a good look around and ran Linpeas.sh which didn't find much, so from here I decided to try SSH into the box as notch with the password we already had (the twist I was talking about).. Bingo!:

Hack The Box Notch User SSH

I quickly grab the user flag:

Hack The Box Notch User Flag

Then taking a look at the capabilities of the notch account getting the root flag is trivial:

Hack The Box Notch User Sudo Perms
Hack The Box Blocky Root Flag

Conclusion

This box was fun and pretty easy, in terms of what I took away from this — make sure you utilize information that you already have to move further, password reuse is very very common never rule it out.

If you are here, thank you for reading :) — on to the next one!

Cheers,

Barry

--

--

No responses yet