Perfect Picture
Writeup for Perfect Picture (Web) - Imaginary (2023) 💜
Last updated
Writeup for Perfect Picture (Web) - Imaginary (2023) 💜
Last updated
Someone seems awful particular about where their pixels go...
Source code is provided, so let's review it before we check .
There's 75 LOC in app.py
so let's breakdown the important parts.
The storage location of uploaded images and allowed extensions are configured.
When we upload a file, it splits on a .
and looks at the rightmost split (extension). If the lowercase string matches the allowed extension (png
) then the filename is allowed.
Next, a random image name is generated.
A check
function is called which will first read the flag into a variable.
The dimensions of the image must be 690 x 420 (w x h)
and specific pixels need match the expected colours.
Next, exiftool
confirms that the metadata is as expected.
If all the checks pass, the flag will be returned!
OK, so based on our analysis we need to create an image with the following properties:
Dimension (w x h) of 690 x 420
Pixel (412, 309
) is (52, 146, 235, 123
)
Pixel (12, 209
) is (42, 16, 125, 231
)
Pixel (264, 143
) is (122, 136, 25, 213
)
Image description
is jctf{not_the_flag}
Image title
is kool_pic
Image author
is anon
I'm lazy, so asked ChatGPT to make a python script (note: exif packages failed for me, as they were strict on keys so used subprocess with exiftool instead).
We upload the generated image and receive the flag in return.
Flag: ictf{7ruly_th3_n3x7_p1c4ss0_753433}