Sunshine CTF 2022

Here at Chompy Game Studios, we have developed a brand-new byte ordering scheme: middle endian! This transformative scheme will surely impress our shareholders! Can you reveal the secret contained within?

(Special thanks to Oreomeister for the concept)

We are given a hex file that has the name flag.png.me.

The file appears to be scrambled, as the name implies:

After looking at the name of the file we can imply that the png header and footer should be present.

So we should see something like this at the end:

And something like this in the beginning:

By searching at the end of our input scrambled file we can see we can form a png header by mixing the top and end most parts of the file.

End part of the input file:

Afterwards we make a python script for demangling:

for i in range(int(len(a)/2)):
    
    temp=a[i*2+1]
    a[i*2+1]=a[-i*2-1]
    if i*2>len(a)/2 or -i*2-1<-len(a)/2:
        break
    a[-i*2-1]=temp

And we get the image:

and