The Khatrimaza-org-mkv Direct

$ hexdump -C hidden.bin | head 00000000 42 49 4e 41 52 59 20 66 69 6c 65 20 73 69 67 6e |BINARY file sign| 00000010 61 74 75 72 65 20 70 72 6f 74 65 63 74 65 64 20 |ature protected | ... The first bytes read – looks like a custom marker added by the challenge creator. 5.2 Entropy check – is it compressed / encrypted? $ ent hidden.bin Entropy = 7.998997 bits per byte. Very high entropy (~8 bits/byte) – it is either compressed or encrypted. 5.3 Try common decompression tools We test a few common formats with binwalk :

Conclusion: the flag is in the video/audio tracks. 5. Deep dive into the suspicious attachment – hidden.bin 5.1 Basic inspection $ file hidden.bin hidden.bin: data

$ mediainfo khatrimaza-org.mkv General Complete name : khatrimaza-org.mkv Format : Matroska File size : 84.3 MiB Duration : 00:03:45.000 Overall bit rate : 2 028 kb/s The Khatrimaza-org-mkv

if __name__ == '__main__': if len(sys.argv) != 4: print(f'Usage: sys.argv[0] <input.bin> <key> <output.bin>') sys.exit(1)

$ cat payload.bin | head -5 HTBmkv_5t34g_1s_4lw4ys_5urpr1s1ng Bingo! The flag is clearly visible. | Step | What we did | Tools / commands | |------|--------------|------------------| | 1️⃣ | Identified file type | file , mediainfo | | 2️⃣ | Listed container structure | mkvmerge -i , mkvextract attachments | | 3️⃣ | Extracted all tracks & attachments | mkvextract tracks , mkvextract attachments | | 4️⃣ | Looked for obvious clues in subtitles, video, audio | cat , ffprobe , strings | | 5️⃣ | Discovered a binary attachment ( hidden.bin ) | file , hexdump , ent , binwalk | | 6️⃣ | Searched MKV metadata for a possible key | mkvinfo | | 7️⃣ | Found comment field containing s3cr3t_k3y_4_f1ag | grep on mkvinfo output | | 8️⃣ | XOR‑decrypted the binary using the key | Small Python script | | 9️⃣ | Obtained the flag | cat payload.bin | $ hexdump -C hidden

Our job is to that the challenge author has concealed somewhere inside the container. 2. Initial Recon $ file khatrimaza-org.mkv khatrimaza-org.mkv: Matroska data, video (V_MPEG4/ISO/AVC), audio (A_AAC), subtitle (S_TEXT/UTF8), 720p, 30 fps The file is a normal MKV with video, audio, and a subtitle track . Next we get a quick look at the container’s structure:

# 1. List the tracks + attachments $ mkvmerge -i khatrimaza-org.mkv File 'khatrimaza-org.mkv': container: Matroska Track ID 0: video (V_MPEG4/ISO/AVC) Track ID 1: audio (A_AAC) Track ID 2: subtitles (S_TEXT/UTF8) $ ent hidden

out = bytes([b ^ key[i % len(key)] for i, b in enumerate(data)])