Encrypted unity3d files

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Nanoka
Posts: 1
Joined: Mon Jan 13, 2020 7:15 am

Encrypted unity3d files

Post by Nanoka »

Hello, I want to ask if it is possible to write a QuickBMS script for this.

I have some unity3d files which some are encrypted like this:

The encrypted chunk starts at 0x60 for all files.
This 2 bytes stored in little endian mark the end of the encrypted chunk:
Image

From 0x61 up to one byte before the offset above, every byte must be xored with the previous byte:

Decrypted file:
Image
Encrypted file:
Image
XOR 0x61 with 0x60:
Image
0x62 xor with 0x61, 0x63 with 0x62 and so on up to chunk end.

This byte from 0x60 should be xored with the one from 0x06:
Image
Now it looks like the decrypted file:
Image

I don't know if the best approach for this would be to do the process backwards in the byte order because of changing the previous values which would be read for each byte.
A simple way to put this could be xor "0x61 up to stored offset minus 1" with xor key being "0x60 up to stored offset minus 2" and then doing the "0x60 xor with 0x06". Maybe.
Then the first few bytes should be replaced by "55 6E 69 74 79 46 53 00" which would read as "UnityFS\x00"

Here is a sample file and the same file manually decrypted: https://mega.nz/#!Y8oknYTZ!IR8XNKTmiSuZ ... f2xW-vrSmQ

Doing this manually for each file is extremely tiring but I have no idea how to write a script and have no coding knowledge.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Encrypted unity3d files

Post by aluigi »

I don't think that's enough.
quickbms has a type of encryption that does exactly what you say (xor current byte with previous/next) but the result doesn't match your provided decrypted sample at 100%.
The bytes are the same only from 0x60 to 0x2616.
I can't work on this thing (still working on the older topics) so I just wanted to give a quick feedback.