VulnNet: Dotpy

https://tryhackme.com/room/vulnnetdotpy

User Flag

Let's start with port enumeration enumeration:

We see there's only one port open (8080). Let's head to the website and see if we find something interesting.

We see a login portal. What about if we create a test account and login with it?

We see there's some kind of panel. We tried using gobuster but didn't find anything useful nor interesting.

After a while, we tried looking for an admin page and got a 404 error. If we look carefully we see there's a potential SSLI vulnerability.

How can we know if a SSTI vulnerability exists? Let's follow the diagram:

We try {{7*7}} and see it's vulnerable.

Let's keep trying.

We got the conclusion it uses jinja2:

So now we have to exploit it. Let's use the following guides to try to get a rev shell.

Unlucky for us, we see our requests are getting blocked.

After trying out we see _ , [ ] and . are filtered

Checking the hacktricks guide we mentioned earlier we can try payload to bypass the filters;

We didn't get the command output but at least we didn't get blocked.

If we url encode the payload we see it works:

We can now try to get a rev shell.

We have to convert it to hex first:

Then we URL encode everything

Now we have to start a nc listener and execute the payload

Let's upgrade the shell.

We can try to swtich accounts using the following:

Let's create a folder in /tmp/ and a file called setup.py inside that folder with the following content:

After that, let's start a nc listener and execute the following command:

Let's grab the flag.

Root flag

Let's check our sudo privileges:

We see that we can set an environment variable. We see backup.py imports "zipfile" so we can creat our own file, change the env and get our root shell.

Last updated