HTB | Help
Last updated
Last updated
This is the Box on Hack The Box Linux Privilege Escalation 101 Track. Find the box here.
GraphQL enumeration
Blind SQL injection
IP: 10.10.10.121
Let's visit port 80
found arbitrary file upload
searchsploit -m php/webapps/40300.py
to copy the exploit
Exploit requires us to upload a PHP shell file, but it is not allowed
i tried php,php3,php5,phtml but no luck
Let's look at port 3000
This port hosts an HTTP API. On visiting the root, there’s a message about credentials with the correct query
Looking at the response headers, I see it’s powered by Express:
Looking around on Google led me to GraphQL, a query language designed for APIs. When I tried paths that didn’t exist, I got this message:
But when I tried /graphql, I got:
This article is a useful guide to enumerating a GraphQL instance. This post was useful to figure out how to interact with GraphQL with curl.
I’ll switch to curl here to hit the API. -s
will silence the progress bar. -H "Content-Type: application/json"
is necessary for the API to handle the JSON data. Then I’ll use -d '{ "query": "[query]" }'
it to send the query. Finally, I’ll use jq
to pretty print the results.
First I’ll get the fields from the schema:
I’ll also get the types of User, String, etc:
I’ll get the fields associated with the User type:
I'll try to get values
from crackstation we got the value.
Now let's try to login to portal
and we are in portal
I tried submitting the ticket with the attachment test.txt. On submitting, I could see my ticket:
The link to the attachment is: http://help.htb/support/?v=view_tickets&action=ticket¶m[]=4¶m[]=attachment¶m[]=1¶m[]=6
If I visit the link I file gets download
The SQLi in the last param. If I add ' AND 1=1-- -'
the file gets downloaded and If I add ' AND 1=2-- -'
I get the below error page
That’s a blind injection. I can pass some tests in, and get true (downloaded attachment) or false (Whoops!) back.
save the request to a text file and run sqlmap
I’ve got the injection. Now I’ll run with --dump. One table that looks interesting is:
we have found the password
let's try to ssh via this
and we are in and found user.txt
Let's copy linux-exploit-suggester.sh to box.
we got many exploits. Let's start with [CVE-2017-16995] eBPF_verifier
Let's copy the exploit to the box and run
found root.txt