Hackthebox Luke Walkthrough
14 Sep 2019
Explanation
Hackthebox is a website which has bunch of vulnerable machines in its own VPN.
This is a walkthrough of machine “Luke” on that website.
Solution
1. Initial Enumeration
TCP Port Scanning:
FTP enumeration:
Gobuster port 80:
Gobuster port 3000:
2. Getting Root
By FTP enumeration, we can find an interesting txt file.
Next, try to enumerate HTTP.
In “config.php” on port 80, we can find a credential for DB.
Then, try to look for the place which we can use following credential.
On port 3000, express is running and we have an API for login possibly.
By googling the error message, we can immediately find following article.
A guide for adding JWT token-based authentication to your single page Node.js applications
Sounds we can use the credential with following way to get a JSON token.
We can access to other path with the JSON token achieved.
“/user” returns a list of users.
We can use “jq” command to make JSON easily readable.
We can put a username to the path and get additional information of user “Admin”.
Similary, we can achieve credential for other users.
Now we found several credentials.
We have several URLs which we can try these creds on.
- http://10.10.10.137/login.php
- http://10.10.10.137/management (Basic AUTH)
- http://10.10.10.137:8000 (Ajenti login console)
By trying creds for “Derry” on /management, we can go to the page which we have some sensitive files.
In config.json, we can find a password for user “root”.
Now we got following credential.
We can use this cred for login to Ajenti.
There is a menu “Terminal” on the bottom of side bar.
Choose and click “New” button.
After that, click the created terminal and we can get a terminal for the root user.
As always, root.txt is in the directory for root.