Task infomation: link
Okay. Let's start.
[+] Encryption steps:
- the flag is encode with base64
2. with a loop convert b64_flag to enc_flag
=> we can code decode function
encrypted_flag is something like this one: 1 + 2 + 3 + 4 + ... + n
=> means if we can calculate len(encrypted_flag) we can recover encrypted_flag (b64_flag = encrypted_flag[-len(encrypted_flag):])
3. take every char in enc_flag and pass it to encrypt func
4. Finally adding some pad data base on the checksum value(we can ignore this one because we can easily remove it from image’s data)
5. putting pixels data and make digest.png
[+] Decryption steps:
Decryption steps
1. take pixels data from the image
2. remove pixels data created from checksum ( check R,B,G > 128 base on encrypt func)
Note: pass some chars to the encrypt() function we can know that every char in the encrypted_flag will return block of 11 pairs (R,G,B)
=> brute-forcing
3. take every block of 11 pairs (R,G,B) from the removed pixels data. Brute-forcing every char in string.printable
4. now we can recover the enc_flag. Calculate len(enc_flag) and finding len(b64_flag) => b64_flag(encoded) => reserved with decode func => b64_flag => decode b64
5. We have the Flag !!!!!
And here’s my final script: solve.py