Plaid CTF 2015 - PNG Uncorrupt

Me and my team, Tower of Hanoi, have played the PlaidCTF 2015: while my teammates did reversing stuff, my friend john and I did this awesome forensic challenge.

This was the challenge description:

We received this PNG file, but we’re a bit concerned the transmission may have not quite been perfect.

It was easy to understand we had to repair a PNG file, but first, we checked what we had in our hands. So, we ran file on the challenge file:

corrupt_735acee15fa4f3be8ecd0c6bcf294fd4.png: data

The file was, in fact, corrupted since it wasn’t recognized as a PNG image. The next step was to recreate the correct PNG header in our file, which should have been
0x89 0x50 0x4E 0x47 0xD 0xA 0x1A 0xA instead of 0x89 0x50 0x4E 0x47 0x0A 0x1A 0x0A, the actual header of our challenge’s file.

With the help of a hex editor we added the missing 0x0D byte, renamed the file and…