The challenge gave us a png file format. Immediately we can use eog to view the contents of this png. However, when doing so, we will get a file format error. We can also run pngcheck to check if the file is a valid png.
┌──(tev㉿kali)-[~/LNC]└─$eogchallenge.png** File Format ERROR┌──(tev㉿kali)-[~/LNC]└─$pngcheck-vchallenge.pngzlibwarning:differentversion (expected 1.2.13,using1.3)File:challenge.png (268637 bytes)thisisneitheraPNGorJNGimagenoraMNGstreamERRORSDETECTEDinchallenge.png
Changing the magic bytes
Thus, I opened the file in a hex editor (Hxd) to check what is causing this error. This is what the first 5 lines of the file's hexdump look like.
From this Wikipedia, magic bytes in short just describe the file signature. The first 8 bytes of the file will tell us if the challenge file given is a png or not, despite the extension (.png). A png file extension would have the first 8 magic bytes as 89 50 4E 47 0D 0A 1A 0A . That is not the case for this file.
All files will have an IHDRheader, which determines a image dimensions. However in this file the IHDR, is "overflowing" into the next line. We can compare a real png to this fake png and see that extra bytes were added 1A 0A. We can just remove them.
Opening up the image shows us a picture of a ship.
We can embed text or files within an image. Thus, we can use Aperi'Solve to see if there is any hidden files or text. We manage to get a hidden text and a zip file (or use zsteg & binwalk respectively) from the image. Unzipping the zip file will require us to get a password which is in the text and this will give us flag.txt.
I have captured your friends, and I won't let them go so easily.
I guess I'll give you a clue, you won't be able to solve this challenge anyway.
\nPassword: AttackAtDawnTomorrow
flag.txt
Haha! Not so fast. I came, I saw, and I intercepted the message!
But I've hidden it somewhere... in case I need the message again.
Uncovering the hidden text
Nothing looks suspicious about this. However, there are other ways to hide messages in text files, that we cannot see (even fancy highlighting). When I transferred the file over to my home machine, I saw there was "white stuff" also known as Zero Width Space.
After some googling, I came across this tool. It is basically a steganography tool that reveals zero width text to plain text. Inserting the zero width text will convert it to binary and we can then convert it back to ascii, giving us the flag.