$ cat writeup.md…
$ cat writeup.md…
hackthebox
"Gotta collect them all." - A Unity game challenge where you need to find the hidden flag.
"Gotta collect them all." - A Unity game challenge where you need to find the hidden flag.
Files:
challenge.zip (password: hackthebox) containing:
Unpacking the archive revealed a typical Unity game structure compiled with IL2CPP:
unzip -P hackthebox challenge.zip file gamepwn_cubemadness1/* # PE32+ executables and Unity data directory
Key IL2CPP indicators:
GameAssembly.dll — compiled game logicglobal-metadata.dat — IL2CPP metadataAssembly-CSharp.dll (which would be present with Mono)Unity stores resources in files:
sharedassets0.assets — main assets (textures, models, sounds)sharedassets0.assets.resS — binary resource datalevel* — level dataUnityPy is a Python library for working with Unity assets:
#!/usr/bin/env python3 """ Unity Asset Extractor for CTF Extracts textures from Unity games """ import UnityPy import os # Load the game data folder env = UnityPy.load("gamepwn_cubemadness1/HackTheBox CubeMadness1_Data") os.makedirs("extracted", exist_ok=True) counter = 0 for obj in env.objects: if obj.type.name == "Texture2D": data = obj.read() counter += 1 name = getattr(data, 'm_Name', f'texture_{counter}') if not name: name = f'texture_{counter}' try: img = data.image img.save(f"extracted/{name}.png") print(f"Saved: {name}.png ({img.size})") except Exception as e: print(f"Error with {name}: {e}") print(f"\nTotal textures extracted: {counter}")
The script extracted 112 textures, including:
splash.pngThe file splash.png (1280x720 pixels) — the game's splash screen — contained the flag as green text on a black background:
HTB{REDACTED}
This is leetspeak for "CUBE MADNESS UNMADDENED" — a wordplay on the challenge name.
On Windows you can use AssetStudio — a GUI tool:
*_Data folderQuick check for the flag in binaries:
strings -a GameAssembly.dll | grep -i "HTB{" strings -a sharedassets0.assets | grep -i "HTB{"
| Tool | Purpose |
|---|---|
| UnityPy | Python library for extracting Unity assets |
| AssetStudio | GUI tool for Windows |
| Il2CppDumper | Recovering C# structures from IL2CPP |
| Ghidra + Il2CppInspector | Reversing IL2CPP code |
$ cat /etc/motd
Liked this one?
Pro unlocks every complete writeup and expanded API access. $9/mo.
$ cat pricing.md$ grep --similar