TryHackMe Write-Up: Mindgames

Introduction

This is my write up for TryHackMe’s Mindgames Room.

Enumeration

Nmap scan shows that both HTTP and SSH are running.

Looking at the webpage, I see what looks like BrainF*ck encrypted text.

Going to dcode.fr, I see that decoding the “Hello, World” code results to a simple Python print statement.

And that the “Fibonacci” code is Python code that prints out the Fibonacci Sequence:

If that being the case, then it might be possible to inject code!

Exploitation

Through some trial-and error, I was able to check the current running directory. I’m not sure but 1-liner Python code seems to be easier.

The above results to:

Encoding the following line:

I was able to get a shell.

Privilege Escalation

Running linpeas.sh, I find that openssl has cap_setuid.

Checking GTFOBins, it turns out that loading a library onto openssl can be used for privilege escalation.

A Google search brought me to the following OpenSSL Blog

It basically describes how to write and build your own OpenSSL engine!

So then, I wrote the following code:

And then compiled it as follows:

Sending it over to the target machine and loading it as shown in GTFOBins, I was able to gain root access.

Originally published at https://m0ndzon3.blogspot.com

--

--

--

I like breaking stuff.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

I built a web scraper!

How to create and use Sitecore command

What Bubble® Visual Programming Platform is about?

WHow to Reduce the Production Bundle Size of Your App? — Angular

Running Neo4j with Hosted Kubernetes in Google Cloud

Installing Kubernetes K8s

Can No-Code Be A Game Changer For The Retail Industry?

Parallel scanning with AWS DynamoDb

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
m0ndzon3

m0ndzon3

I like breaking stuff.

More from Medium

IIUC CyberCon 2022 CTF Write-ups

NahamStore Write-up TryHackMe

RootMe TryHackMe CTF Writeup

4. Oopsie — Beginner/Learning Box