Securebug.se CTF Odin 2021: Artwork

Artwork

Category: Cryptography

50 points

Take a look at this artwork.

File: art.md

Solution

The attached file looks like a utf-16 encoded mess. But, in fact it isn’t. The script below is self-explaining.
Workflow is as below:

  1. drop all the non-printable characters
  2. base58 decode the payload
  3. base64 decode the payload
  4. replace all ‘I’ and ‘l’ with ‘0’ and ‘1’
  5. read the payload as binary written string
  6. get the flag ;-)
import base58
import base64
from string import printable

file = open('/home/luc/Pobrane/securedebug/art.md', 'rb').read()
flag_encoded = ''.join([chr(i) if chr(i) in printable else '' for i in file])
flag_b58_decoded = base58.b58decode(flag_encoded)
flag_b64_decoded = base64.b64decode(flag_b58_decoded)
flag_binary = flag_b64_decoded.replace(b'I', b'0').replace(b'l', b'1')
flag = bytes.fromhex(hex(int(flag_binary.decode('utf-8'), 2))[2:])

print(flag.decode('utf-8'))

Flag

SBCTF{73h_4r7_0f_D3c1Ph3r1Ng}

Privacy Policy
luc © 2021