Challenge

You are provided an apng (animate PNG) file. Find flag.

Solution

Prior work:

  • run apngdis on movie.apng to get all included pngs
  • sort files by size -> later files are bigger, but 2 files stand out from size: 438 and 580

  • manual inspection of bitplanes with https://stegonline.georgeom.net/upload -> confirmation in next plot
import cv2 as cv
import matplotlib.pyplot as plt
from bitstring import BitStream, BitArray

with open("out.zip", "wb") as f:
    for name in ["apngframe0438.png", "apngframe0580.png"]:
        img = cv.imread(name)
        blue_plane = img[:,:,0] & 1 # get LSB from 0'th channel (blue)
        plt.imshow(blue_plane); plt.show()  # debug printing so that we know we have the correct files
        bits = "".join(blue_plane.flatten().astype(str))  # flatten 1920x1080 array of 0/1 to string
        by = BitArray(bin=bits).tobytes()  # bitstring to bytes
        f.write(by)

Results in a zip containing a video: