image.png

If you aren*’*t familiar with the concept of file signatures, you might want to do the challenge ‘QR Insanity’ first.

In this challenge, we’ll bypass the image upload restriction and execute a reverse shell, which will give us full CLI access to the machine hosting the challenge.

The file upload complains if we don’t hand it specific image formats. In this case, the php is doing a MIME type check.

We’ll start by crafting a reverse shell.

Identify the IP Address of your Kali Linux machine.

hostname -I

image.png

Next, go to revshells.com and find the PHP PenTestMonkey reverse shell

image.png

Copy the code and paste it into a file called evil.php

image.png

Once the file is saved, we can use the file utility on Linux to do exactly what this website does. It will check the first few bytes of the file and report back what type of file signature it has.

file evil.php

image.png

In a text editor (or HEX editor) we can simply change the first few bytes of the file so that it conforms to what is expected from valid GIF images.