Creds >>

TryHackMe – https://tryhackme.com/p/TheSysRat

HackTheBox (aka TheSysRat)


Discovery >>>

nmap >>

Port 80 is open and there is running WordPress 5.4.2 🙂 other ports are not interesting … So we can inspect WEB >

Web >>

Basic web site, so we can try to find via WPScan a user, if we have luck, XML-RPC is enable, we will try to start a bruteforce atack to find a password.

So there is a result >

So we found a user “sysadmin” and XML-RPC is enable, let’s bruteforcing >

And we can found a password, if take attack more then 5 minutes, something is wrong 😉

So we can try to login, and try to get shell >

NOTE: VM is really slow in this process, be patient ;-).

Web-Flag >>>

I tried to change a template files but no luck some error sFTP setting is wrong.

So we can use malicious plugin to install >>

Prepare >

I download “Hello Dolly” plugin and add in the end PHP PentestMonkey payload, you can use this tool https://www.revshells.com >

NOTE: Add without “<?php” in the beginning and “?>” in the end ;-)…

And save in the archive.

Upload plugin and install >

If everything was OK, plugin will be installed >

After that we will start listener nc on port what you select >

And we will click on “Activate plugin” after relatively long time we will get a shell as www-data >

We can found first web flag (try look on web folder) !

There we can also found note.txt with some hints >

Pivoting to user >>>

So we can make some enumeration. We can found some interesting thing, we are in the docker container. But no much tools are there, we don’t have tolls like nmap, netstat, ip, ifconfig, arp and etc. Linpeas didn’t help too much.

We can try to enumerate connection, there will be any way to get user access.

For beginning we will try to looking for other connection >

cat /proc/net/route

So we can find 3 connection, let’s enumerate >

We can use great tool routingtableparser >

https://gist.github.com/incebellipipo/6c8657fe1c898ff64a42cddfa6dea6e0

On our machine we can follow to compile >

We will send program to victim machine via curl >

And there is one interesting interface on eth2 and IP 172.18.0.1. Let’s enumerate >

Static NMAP not work, there are missing some dependencies and privileges in container.

So we can use my script >

https://github.com/TheSysRat/InterScan

And there is result port 22 is OPEN>

Great we can use chisel to pivot >

https://github.com/jpillora/chisel

On attacker machine >

On victim machine >

So now we will have a ssh forwarding on port 8888, let’s try >

And success, password is same as used on WordPress. 🙂

User Flag is DONE !


ROOT Path >>>

Now we can run Linpeas and we will found this >

We are in lxd group! >>

So let’s get ROOT flag >

On our attacker machine we have to build lxd alpine container >

After that we will find this build archive

And transfer file alpine-v3.19-x86_64-20231229_1510.tar.gz to victim machine >>

If everything is good we are able to read root flag >

So this machine was PWNed !!

Happy Hacking, see you next time !! 😉

Leave a Reply

Your email address will not be published. Required fields are marked *