Instant (HTB)
I said NOW.
Intro.
Hi fellos today we have yet another HTB season machines let's get right into it.
Enumeration.
Port scan.
So classic we have HTTP and SSH.
Let's enum HTTP.
So after long time of enumeration including fuzzing, subdomain enum, directory search it turns out it was way simpler. So first thing come to my mind when i visit the website is to download the file i download it, it was .apk file.
then i though that the main object was there so i decopress the files.
at first glance i though nothing is in here is just a rabbit whole so i came back to the website and i did all the enumeration and no good. https://forum.hackthebox.com/t/official-instant-discussion/327960 then i navigate to the offial discussion and i saw one of the people says search more in the apk file so that's what i did and i find what i was looking for.
two subdomains exist under res/xml/network_security_config.xml.
So after some time testing with diffrent username password trying to get access to the admin enpoints.
Path traversal
Was a bearer token which is jwt web token.
so i though it maybe expired but i tried it anyway.
So after i got the admin token i start looking around and the most intresting things was the logs and the users. the users only contain users sure. But the logs contains logs file regarding the endpoints.
Let's first see the avaliable logs and then tried to read them.
So we can see the file name and the path that files exist in, So let's read it.
The most importan thing in this image is that it uses query parameters to get the file name could it be LFI or Path traversal ???.
Emphasizing the Difference between LFI and Path Traversal
Local File Inclusion (LFI) occurs when an application improperly handles user input for file inclusion. Typically, this happens when an application accepts a file path from the user to include or display within a webpage, but does not properly restrict or validate the path. In this scenario, attackers can specify any file path on the server, causing the application to load and sometimes execute files from anywhere on the system. In PHP, for example, functions like include
and require
are often at risk if used insecurely.
Path Traversal, also known as Directory Traversal, is similar to LFI but has a different focus. Here, instead of including files into the application, the attacker tries to directly access restricted files by manipulating the file path. By using traversal sequences (like ../
), attackers can navigate to directories outside the intended file path and access sensitive files that weren’t meant to be exposed
So i tried both and the one that it works was the path traversal.
shell as shirohige.
So with all thing information we could access her ssh key.
And the pain was in cleaning this ssh key but we did it.
Shell as Root.
So from there i just did some basic enumeration and i found solar-putty session file in the opt directory.
And a bit more search i found that this could be crackable. thanks to https://xtromera.github.io/
I was able to crack it using the following python code.
and it turns out that it give us the root password now we just need to login as root.
Ending.
at this end this machine was one of the best machines that i ever played due to the ideas that it had from the inital access to the root eveything is new. Great work from HTB actully.
Last updated