SNAKEOIL is another machine from Digitalworld.local series from Vulnhub by Donavan.
The description says: “Recently, Good Tech Inc. has decided to change their application development process. However, their applications look broken and too basic. Is this an application full of snakeoil, or are they insecure too? This goes beyond PEN-200, and some web application development expertise could be helpful”.
Get Ahmed Shamroukh’s stories in your inbox
Join Medium for free to get updates from this writer.
Link to the machine:
Information Gathering
Let’s find the target’s IP address.
┌─[a7@Parrot]─[10.10.10.2]─[~/Desktop/vulnHub/Digitalworld.local:SNAKEOIL]
└──╼ $fping -agq 10.10.10.0/24
10.10.10.1
10.10.10.2
10.10.10.7Port Scan
Scan the target for open ports and running services.
Press enter or click to view image in full size

Web Server Enumeration
First, let’s visit port 80.
Press enter or click to view image in full size

Just a page telling us SNAKEOIL is set up properly, examining the source code, and nothing useful. Let's visit port 8080.
Press enter or click to view image in full size

When we click on Introduction, we got a post, but look at the URL.
Press enter or click to view image in full size

Back to the main page, click on House Rules.
Press enter or click to view image in full size

We got username Patrick, and again notice the URL.
Now, head back and click on Useful Links.
Press enter or click to view image in full size

We got some information, first, it’s flask, second, there is some kind of authentication mechanism like JWT (JSON Web Tokens), anyway, there’s a link, let’s visit it.
Press enter or click to view image in full size

It’s about configuring JWT.
Our next step is to launch gobuster.
Press enter or click to view image in full size

Firstly, let’s try to change the directory from 4 to 3.
Press enter or click to view image in full size

This is the ‘404 Not Found’ message in JSON format which means there is no page with that name.
Moving on, let’s browse test.
Press enter or click to view image in full size

Now, open Burp, and visit all links on the website including those found by gobuster for more analysis.
Press enter or click to view image in full size

Notice create, let's browse it.
Press enter or click to view image in full size

Let’s create a post.
Press enter or click to view image in full size

Submit.
Press enter or click to view image in full size

Click on Edit.
Press enter or click to view image in full size

Back to Burp, send the interesting requests to Repeater for more analysis.
Starting with login.
Press enter or click to view image in full size

The METHOD NOT ALLOWED, change the request method.
Press enter or click to view image in full size

We got BAD REQUEST which means the request sent to the server is invalid or corrupted, add username=patrick&password=patrick.
Press enter or click to view image in full size

Let’s jump to registration, when we send the request it responds with Wrong Method so change the method.
Press enter or click to view image in full size

Bad request, obviously the method is POST and the page is registration, so let's add a new user.
Press enter or click to view image in full size

Check our user on users.
Press enter or click to view image in full size

Back to login, log in with the user admin.
Press enter or click to view image in full size

We got Access_Token! Anyway, we analyzed users, login, registration, we have two left, let's analyze secret.
Press enter or click to view image in full size

Let’s send a request to run.
Press enter or click to view image in full size

Change the method.
Press enter or click to view image in full size

This one took me some time till I notice my mistake.
Press enter or click to view image in full size

Let’s do it.
Press enter or click to view image in full size

Where the :) is my secret key.
Let’s visit secret.
Press enter or click to view image in full size

After a few tries, thinking maybe expect a cookie or token, so let’s add one.
Press enter or click to view image in full size

Tried it but didn’t work so I visit the link we found earlier.
Press enter or click to view image in full size

Try it again.
Press enter or click to view image in full size

We got the secret key, now let’s add it in run.
Press enter or click to view image in full size

We got some kind of command output, we may be able to inject commands.
After playing around, turns out it’s curl.
Press enter or click to view image in full size

The url parameter is vulnerable to command injection, so let's send some commands.
Press enter or click to view image in full size

Tried to list files and directories.
Press enter or click to view image in full size

After browsing these files, found an interesting one.
Press enter or click to view image in full size

Getting Access
Tried to log in with ssh with the obtained creds.
Press enter or click to view image in full size

When we check for SUDO permissions, we could run anything as root, let’s get root.
Press enter or click to view image in full size
