Pxrtxblx Nxtwxrk Grxphxcs [Misc]
Patch corrupted PNG file to recover the image.
Challenge Description
Cxn yxx rxcxvxr xt?
Solution
First, we must understand the PNG file structure. A PNG file consists of multiple sections, mainly IDAT, which contains the data of the image. All the sections must be valid according to the specification.
I used an online tool to make my life easier.
We immediately see that the file signature is wrong. More precisely, the first few bytes (known as the magic bytes) are not that of a PNG file’s. We can quickly fix that with a hex editor.
Then, we reupload the fixed image onto the tool from earlier.
I replaced the CRC with what’s expected, assuming the data is correct, and removed the unknown chunk of data.
However, the image was empty. I fiddled around with pngcheck
and found out it’s something wrong with the IDAT section, because a zlib error -5 (buffering error) was thrown.
I had no idea how to fix so I just used an online tool again. And that worked, giving us the image with the flag.
Flag: wgmy{e6fb725a5b2e25429442dbd568ce058e}