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

How to set up Kubernetes master-slave architecture?

Reduce Cost and Increase Productivity with Value Added IT Services from buzinessware — {link} -

Using mobile internet (USB tethering) for Raspberry pi

Build, Test, and Deploy to IBM Cloud Private — Continuous Delivery with Jenkins, Container…

How to dockerize a C++ Drogon Web Application ( web app) in an existing project for the web?

Setup Salesforce Knowledge

Setting Up a New M1 MacBook for Data Science

Kubernetes Deployment Strategies

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

TryHackMe | Overpass

HTB No Place to Hide [easy] Forensics Challenge

LOG4SHELL: CRITICAL LOG4J VULNERABILITY CVE-2021–44228 (Effects ON Fortigate Firewalls)

For the Deep Zappa Fan