Explore is a easy box from HackTheBox. This box is a mobile system, a phone and it was my first mobile box on HTB.
Welcome to the writeup of Explore box from HackTheBox. This box is a mobile system, a phone and it was my first mobile box on HTB. It's not a complex box, but it's interesting. | ||||||||||||||||||||||||||||||||||||||||||||||
Let's go! | ||||||||||||||||||||||||||||||||||||||||||||||
NMAP | ||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||
According to the information presented by the scan, this is a phone... | ||||||||||||||||||||||||||||||||||||||||||||||
Researching about the identified services I found some interesting infos. | ||||||||||||||||||||||||||||||||||||||||||||||
JSONAPI is a plugin for Bukkit that allows you to access data and other information about your server and your players through a simple, yet secure, HTTP API. This allows you to make awesome websites, iPhone apps, and a way for your players to purchase goods online and automatically receive them in game. - https://github.com/alecgorge/jsonapi | ||||||||||||||||||||||||||||||||||||||||||||||
Port 42135 is running a ES File Explorer this creates an HTTP service bound to port 59777 and doing a search you can find a public exploit (CVE-2019-6447). | ||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||
Through this exploit I could read some files and with attention I could find an interesting .jpg. | ||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||
This .jpg has notes looking like credentials... As enumerated before, the SSH service is running on port 2222 and using this credentials we were able to login successfully. | ||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||
Now we are inside and are able to find the user flag at /sdcard. | ||||||||||||||||||||||||||||||||||||||||||||||
Privilege Escalation | ||||||||||||||||||||||||||||||||||||||||||||||
Looking for a way to own the Android system I found some things about Android Debug Bridge (adb) - a development tool that allows communication between an Android device and a computer as a shell. | ||||||||||||||||||||||||||||||||||||||||||||||
As some documentations the adb opens a localport (as "system") 5555 and its possible to connect on it through USB setting the configured port, but is possible to bypass this "restriction" doing a portfoward to our machine, in this case, using SSH to do that. | ||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||
After insert password to stabilish connection the SSH shell starts, but in another terminal its possible to see the localhost port 5555 fowarded to our machine. With that, its possible to interage on this port and we will use adb to do that. | ||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||
After connect and get a shell with adb we are inside again but through adb. | ||||||||||||||||||||||||||||||||||||||||||||||
Adb is running with privileges so we can elevate our privilege to root with a simple command su root. | ||||||||||||||||||||||||||||||||||||||||||||||
And now as root I could found the root flag using find command to search it. | ||||||||||||||||||||||||||||||||||||||||||||||
Thanks for reading and feel free to pingback a coffee ;D | ||||||||||||||||||||||||||||||||||||||||||||||
naP0 | ||||||||||||||||||||||||||||||||||||||||||||||
Give a Pingback | ||||||||||||||||||||||||||||||||||||||||||||||
References: | ||||||||||||||||||||||||||||||||||||||||||||||