How to unpack UnityWebData1.0 in Unity WebGL games

UnityWebData1.0 is a standard of data file used by WebGL games.

It is loaded along with the game binary and contains some resources like shapes, 3D objects, sounds, and so on.

Besides these resources, it may contains the Il2Cpp metadata that is useful to simplify the reverse engineer of the WebAsm code.

The IL2CPP (Intermediate Language To C++) is an alternative to the Mono backend. The IL2CPP backend converts MSIL (Microsoft Intermediate Language) code (for example, C# code in scripts) into C++ code, then uses the C++ code to create a native binary file.

This type of compilation, in which Unity compiles code specifically for a target platform when it builds the native binary, is called ahead-of-time (AOT) compilation. The Mono backend compiles code at runtime, with a technique called just-in-time compilation (JIT).

Popular disunity tool doesn’t handle this type of file, and binwalk or file(1) aren’t helpful this time, so we need another way to realize it.

To see if we are looking at a UnityWebData1.0 data file, simply check the header, which contains the string “UnityWebData1.0.”

UnityWebData1.0 file header
As you can see “file” is not very useful this time

We can use a UnityPack python library via this small wrapper. It will create a folder with some files, named “extracted”. This is the usage:

Usage: ./unpack-unitywebdata1.0.py <UnityWebData1.0 file>
Unpack UnityWebData1.0 file with “unpack-unitywebdata1.0.py”
Content of “extracted” directory

That’s all, happy reversing!

Leave a Reply

Your email address will not be published. Required fields are marked *