Deep Fried Data - Misc
Points: 465 | Flag: 0xfun{d33p_fr13d_3nc0d1ng_0n10n} | Solved by: Smothy @ 0xN1umb

what we got
a single file notes.txt that file says is gzip compressed. challenge description says "if you fry something enough times, it becomes unrecognizable" so we're looking at layers of encoding/compression stacked on top of each other like a cursed onion
the solve
ran file on it - gzip. decompressed it - zlib inside. decompressed that - base64. and it just kept going lmao
wrote a python script to recursively detect and decode:
import gzip, bz2, lzma, zlib, base64
import string
data = open('notes.txt', 'rb').read()
while True:
if data[:2] == b'\x1f\x8b': # gzip
data = gzip.decompress(data)
elif data[:2] in (b'\x78\x9c', b'\x78\x01', b'\x78\xda'): # zlib
data = zlib.decompress(data)
elif data[:3] == b'BZh': # bzip2
data = bz2.decompress(data)
else:
text = data.decode('ascii').strip()
charset = set(text)
if text.startswith('<~'): # ascii85
data = base64.a85decode(text[2:text.rindex('~>')])
elif charset.issubset(set('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=')): # base32
data = base64.b32decode(text)
elif charset.issubset(set('0123456789abcdefABCDEF')): # hex
data = bytes.fromhex(text)
else: # base64
data = base64.b64decode(text)
if b'0xfun{' in data and b'keep_decoding' not in data:
breakthe encoding layers used (132+ rounds total):
- gzip compression
- zlib compression
- base64 encoding
- base32 encoding
- hex encoding
- ascii85 encoding
all mixed together in random order. truly deep fried fr
at round ~87 there's a troll fake flag: 0xfun{lol_not_yet_keep_decoding} followed by REAL_DATA_FOLLOWS: and more encoded data. had to strip that and keep going for another ~45 rounds of base64 until the real flag dropped
flag
0xfun{d33p_fr13d_3nc0d1ng_0n10n}
the name makes sense now - deep fried encoding, peeled like an onion. 132 layers of compression and encoding. absolute madness
smothy out ✌️