Post

HackTheBox_Brainfuck w/o Metasploit

HTB - Brainfuck

Image

Enumeration

nmap scan results

Image

homepage

Image

inspecting the certificate

Image

Image

www.brainfuck.htb

sup3rs3cr3t.brainfuck.htb

adding these to our /etc/hosts file

Image

sup3rs3cr3t.brainfuck.htb

Image

www.brainfuck.htb

Image

wpscan enumeration for WordPress sites

Image

Image

Image

lets get a list of vulnerabilities as well by giving the apikey using the api switch —api-token [apikey]

Image

on checking dev-update poste we find the username as admin

Image

lets use wpscan to enumerate the users as well, using the enumerate-user flag

Image

Image

Vulnerabilities

Image

lets check this one out

Image

Exploitation

modifying the script with the credentials we got from our enumeration stage

Image

lets now save it as an html file

Image

hosting it with python

Image

lets visit our local host now

Image

Image

Image

now we should be logging in. On revisiting the site, we used a cookie that tells the browser that we are a logged-in user, allowing us to log in as anyone including admin.

Image

Image

the site seems to be hinting at smtp, so lets check that out

dashboard

Image

Image

Image

ok so we have the password being shown here for the user orestis, but its not really visible. lets see if we can do something about it with inspecting

orestis:kHGuERB29DNiNE —> our smtp creds

Image

ok now that we have the creds, lets use Evolution

Image

Image

Image

now after we are done with this, we go back to the homepage to be greeted with an authentication request.

lets use the password we got earlier

Image

on inspecting the mail we find these credentials

Image

lets use these details for the supersecretforum page we found earlier during enumeration.

orestis:kIEnnfEKJ#9UmdO

Image

Image

ok so this tells us that the ssh access now only uses keys, and the key is apparently being shared in a secret forum.

lets check that forum out

Image

alright, so the messages seem to be encrypted

so straight off the bat we notice that

Image

Image

seems to be a signature, and judging by the same word length, these might be the same sentences.

lets try cracking the cipher with this

so right off we can tell that this might be a vernam cipher, lets try using this website to decode the key

Image

Image

we get the key as fuck my brain

now lets decrypt the forum using this key we got

Image

Image

Image

Image

Image

ok so we got the link for the key, lets visit it

for some reason I keep getting this 404 not found page

Image

lets try grabbing it with this instead

BASH wget –no-check-certificate https://brainfuck.htb/8ba5aa10e915218697d1c658cdee0bb8/orestis/id_rsa BASH

Image

alright so this seems to work, now we check out the key

Image

we have our RSA private key, but it is encrypted

lets use ssh2john to put the RSA key in a crackable format

Image

now lets give the crackthis file to john for decrypting

Image

using john we got our key as 3poulakia!

now lets try logging in with ssh -i id_rsa orestis@brainfuck.htb

Image

lets try again but with changing the permissions before

Image

and we are in

Image

lets check the other files out as well

Image

orestis@brainfuck:~$ cat output.txt
Encrypted Password: 44641914821074071930297814589851746700593470770417111804648920018396305246956127337150936081144106405284134845851392541080862652386840869768622438038690803472550278042463029816028777378141217023336710545449512973950591755053735796799773369044083673911035030605581144977552865771395578778515514288930832915182

so the root.txt file seems to have been encrypted using this

Image

ahh we need to do some priv esc.

lets use linpeas to perform a scan for some possible priv esc vectors

we first get linpeas from https://github.com/peass-ng/PEASS-ng/releases/tag/20240811-aea595a1

Image

we will now host it on a server using python for our box, as htb boxes don’t usually have internet access

Image

lets use wget now

Image

we have it now in our tmp folder, lets run it

Image

forgot to change our permissions first

In linpeas, a RED/YELLOW box has a 95% chance at being a viable privesc vector.

Image

under the exploit section we find a few to choose from

lets go with this exploit

Image

Image

we got the exploit on our system

lets unzip it

Image

now lets list its contents

Image

now lets execute it

Image

we have our root flag now

Image

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.