Perfect Picture

Description

by FIREPONY57

Someone seems awful particular about where their pixels go...

Attachments: Sourcearrow-up-right Server: http://perfect-picture.chal.imaginaryctf.orgarrow-up-right

Solution

  1. Only PNG is allowed app.config['ALLOWED_EXTENSIONS'] = {'png'}

  2. PNG goes through some checks which should be True.

def check(uploaded_image):
    with open('flag.txt', 'r') as f:
        flag = f.read()
    with Image.open(app.config['UPLOAD_FOLDER'] + uploaded_image) as image:
        w, h = image.size
        if w != 690 or h != 420:
            return 0
        if image.getpixel((412, 309)) != (52, 146, 235, 123):
            return 0
        if image.getpixel((12, 209)) != (42, 16, 125, 231):
            return 0
        if image.getpixel((264, 143)) != (122, 136, 25, 213):
            return 0

    with exiftool.ExifToolHelper() as et:
        metadata = et.get_metadata(app.config['UPLOAD_FOLDER'] + uploaded_image)[0]
        try:
            if metadata["PNG:Description"] != "jctf{not_the_flag}":
                return 0
            if metadata["PNG:Title"] != "kool_pic":
                return 0
            if metadata["PNG:Author"] != "anon":
                return 0
        except:
            return 0
    return flag

Let's craft the Perfect Picture!

Submit and get flag.

circle-check

Last updated