TryHackMe-Enpass

Rustscan

So we have 2 ports open , 8001 (HTTP) and 22 (SSH)

PORT 8001 (HTTP)

At the the bottom of the page we see an encrypted text

Which is ROT13

We have another text which is encrypted

This again lead us to nowhere. So I decided to fuzz for directories

Doing with feroxbuster I found that /web has more directories or files in it

As we found /reg.php

There’s a input filed where we can type and submit.Trying for RCE by running id resulted incorrect

Looking at the source it’s running a php script that is checking for input so here !preg_ match('/[a-zA-Z0-9]/i will reject the regular expression pattern for upper and lowercase characters also digits and explode is going to split the string into sub string using ,. Then the for loop will run 8 times and it's checking if the string's first character has a length of 2 and last character of the string which is 8th (starting from 0) character must be of length 3 then it's further checking that 5th character and 8th character must not be equal similarly for 3rd and 7th value.

So this means we can only use special characters

@@,$,$,*,$,!,$,!,@@@

This will pass the checks as the value on the 0th index is of length 2 @@ 8th index value is of length 3 @@@ Value at 5th index is not similar to the value at 8th index ! , @@@ And the value at 3rd index is not similar to value at 7th index *,!

It’s not necessary that this will be the exact string

$$,!,&,!,^,^,^,*,%%% This can pass the checks as well

On entering the string

While ferxobuster was running in the background there were directories up to configure

I ran dirsearch again and finally found a file

It’s better to run other tools because gobuster was failing for me and feroxbuster didn’t find the key file

But I don’t know the username so can’t really ssh into the machine

These archives had the same files and some had recursive archive with content sadman

So we have the key which is passphrase of id_rsa and we also have the ssh private key so let’s see if we can login

And this gives us an error maybe sandman isn't the correct username. Looking at the hint we see that it's saying something about bypassing

We know that there is 403.php page that gives us 403 status code which is Forbidden client error

So I googled for by pass scripts and found this so thought about trying and see if this lead us to somewhere

I don’t think this worked

Then I used another script from github
https://github.com/intrudir/403fuzzer

You can see the status code is 200 but here focus on the length for 200 status code as this the home page (/)

Here we see a change in length of status code 200 which is 917 so let's try using this as our url

And bingo we got the username so now let’s ssh into the box

Transfer psyp64 on the machine

A cronjob for root user is running that first changes the ownership of file.yml then runs the python script and removes the file.yml also there exists a yaml de-serialization vulnerability so we can make a payload for setting SUID on /bin/bash

We can grab the root flag !!

--

--

Smol Pentester | CTF Player | UwU

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store