CREDS >>

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

HackTheBox – https://app.hackthebox.com/profile/1298347


TryHackMe >>

https://tryhackme.com/r/room/breakmenu


Recon >>>

nmap >>

Port 80/TCP >>

On first look, we can see basic Apache page >>

So we can try to fuzz content >>

And we can found /wordpress CMS >

Looks basic, so let’s enumerate >>

And we can found this >>

  • XML-RPC seems to be enabled
  • Users : adnim and bob
  • WordPress version 6.4.3 identified (Insecure, released on 2024-01-30)
  • wp-data-access – version 5.3.5 – insecure version able to manipulate with role of users

Let’s try to bruteforcing user bob >

And we can try to login >

And we can see restricted user account. So we can try to upgrade this account to administrator role.

How it works? There is CVE-2023-1874 , this vuluneralibity cause, that we can save settings, we can add this parameter “wpda_role[]=administrator” and change role of user ! So let’s start BurpSuite and try to upgrade >>

After forwarding request we have full administrator account >

So we can get shell, I used edit and update plugin and add reverse shell inside akismet.php >>

Simple generate reverse shell on https://www.revshells.com/ and use PHP PentestsMonkey >

Add inside without <?php and ?> in the and run nc and activate plugin, if everything was O.K. you can get reverse shell to you >

So we can look around and find this possibilities >>

  • There are some users with bash >
  • Port 9999 look interesting
  • Some credentials are inside wp-config.php file, but not useful

So we can look on port 9999 and what is running there and who is running this service >

We can start pspy64 and look on it >

User UID 1002 is user john, so we can try to forward and look on this site >

I used chisel simple port forward >

  • Start server side on attacker machine >
  • And connect from victim machine >

And we can check our forward port if is working >>

We can found some testing tools, it look like Command Injection action >

So we can try to bypass if it is possible, let’s start with simple allowed chars >

And we can see that some possibilities are there, lets try…

I try many options, but one look useful, let’s try to connect to our attacker machine >

But when we look on python http.server we have connection >

So prepare reverse shell payload and save to rev.sh after that we can run python http.server on port 80 >

And final payload to command injection >

And of course start nc >

And we can run, if everything O.K. we will get shell as john user >


Movement to user youcef >>

After new research we can found this custom SUID program >>

We can download and try to reverse this program and find some possibilities >>

After decompiling app we can found this function >>

It looks like Flip Coin challenge or Race condition, you can study lok it there >

https://medium.com/@ramalchakkalakkal/tryhackme-walk-through-room-flip-93444bf8d711

https://medium.com/@jityrana007/race-condition-tryhackme-walkthrough-4483b95d05f7

Long story short, there is trick to bypassed, we can used system link to file which we will read and create loop for read it is is success, just stop whole proccess and print file what we will to read. There is little delay between we load file and check if we have permitions to read it. So lets try >>

We will of course id_rsa file to user youcef >

NOTE: For some reason is not working directly from /tmp or /dev/shm folder !! Try other location like /home/john or create subfolder in /tmp !

Now we have id_rsa file of user youcef, so we can save change permissions and try to connect >

But we need passphrase, so let’s try to crack it >

Now we can connect over SSH >


ROOT Path >>>

In next research we can found this in sudo -l >>

If you are interested, you can learn for example there >

https://anee.me/escaping-python-jails-849c65cf306e

Principe is find way that is allow and escape to shell as root, so we can look on built in function >

And one built in function is special interesting breakpoint(), we can use this debug function to escape!! Let’s try >

And it works !!

And we are DONE!

BreakMe machine was PWNed !!

Happy hacking!!

Leave a Reply

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