The Head Bone is Connected to The Bash Shell- Compressor: HTB Cyber Apocalypse 2022
Ramona’s obsession with modifications and the addition of artifacts to her body has slowed her down and made her fail and almost get killed in many missions. For this reason, she decided to hack a tiny robot under Golden Fang’s ownership called “Compressor”, which can reduce and increase the volume of any object to minimize/maximize it according to the needs of the mission. With this item, she will be able to carry any spare part she needs without adding extra weight to her back, making her fast. Can you help her take it and hack it?
This was the first of the misc challenges. I’m not sure if my solution was intended, but it was easy and it works, so why not?
The Challenge
We’re given an ip and address of a python server. We have a nice set of menus that seem to correspond to the directory structure on the server.

The solution
Seeing linux commands anywhere in a challenge screams command injection. We can confirm this by trying some special characters, like ‘;’, which is a way to chain commands together. Let’s try injecting the id command after the cat command:

We see that we have command execution! Now we just need to find the flag. After using ls commands on the parent directories, we eventually figure out that the flag is two directories above the current:

Lastly, we just use the cat command to read the flag!

Boom! We have the flag! Hopefully Ramona can put this compressor to good use!
If this was interesting at all, helped you with one of your challenges, or if you have any questions or corrections, please drop me a line!