We are given magic.png file, which we cannot open:

Lets try and open it in hexedit to look at the file header:

Seems like the PNG magic bytes is missing, so we write them in:

But we still fail:

Lets use pngcheck to see what is wrong:

If the open the file in hexedit again we can see that the IHDR chunk was renamed to JHDR:

Lets change that:

Lets check it now:

Lets fix the checksum:

We can know open the image:

Hmm… no flag, seems like we are missing something, lets see if we can add some more height to the image.

Looking at wikipedia we can see the IHDR chunk defines the weight and height of the image:

So lets change the height:

If we check pngcheck we can see that the crc doesn’t match anymore again:

So lets fix that:

We can now open the image and see the flag:

And we get the flag: DDC{PNG_f1l3_m4g1c14n}