2

I was trying to recreate this game because it was down but I really love it.

I tried to decompile the apk and I got the java code and the assets then I looked around the code and found out the main code is not in the java but the lua folder inside the assets but the thing is that it get encrypted by XXTEA (For Example: this is main.lua).

So I'm trying to use IDA to read the lib .so file to find the key but it's a bunch of stuff that doesn't let me get the key easy so I tried to use frida to trace and print out the key when the decrypt get called but sadly because the server was down so the function never get called.

Please help me decrypt all the lua file or at least pls help me get the key to decrypt it, I really need it.

7
  • I'm way out of my depth here but opened the .so file in IDA just to have a look - I notice there's a getGameTeaKey function with a hardcoded string of "kaiqigu-chuangshiji" - might be a start? Also the main.lua file you posted doesn't seem to be encrypted. Commented Sep 5, 2023 at 14:08
  • sorry wrong main.lua file
    – NoName
    Commented Sep 5, 2023 at 14:17
  • also XXTEA require 16 bytes key and "kaiqigu-chuangshiji" is not 16 bytes so it's not XXTEA key
    – NoName
    Commented Sep 5, 2023 at 14:19
  • i edit and give the right main.lua link right now sorry about that
    – NoName
    Commented Sep 5, 2023 at 14:21
  • Maybe it's the first 16 bytes, i.e. "kaiqigu-chuangsh". Commented Sep 6, 2023 at 9:13

1 Answer 1

2

xxteakey for decrypt lua: aaa

xxtea_decrypt function jump to cocos2dx_lua_loader+F6 1

Press F5 (decompile to pseudocode)

void * xxtea_decrypt(const void * data, size_t len, const void * key, size_t * out_len)

v22 is a key load from off_5E4660 2

Goto address 5E4660 3

key is: aaa, full key size 16 from hex: 61 61 61 00 00 00 00 00 00 00 00 00 00 00 00 00

7
  • thanks for your comment and the tutorial of how to get it but i had to tell u that i tried "aaa" and even a (cause on the image it's v22[0] so i tried it after aaa fail) but "aaa" and "a" is both fail it said wrong key. I removed the XXTEA at first cause i know we need to remove it before we decrypt it too but still fail
    – NoName
    Commented Sep 8, 2023 at 7:38
  • i don't know if i did it wrong or sth. Can you try to decrypt the lua file to see if it work or not please
    – NoName
    Commented Sep 8, 2023 at 7:40
  • You need to ignore the first 5byte header : XXTEA sample decrypted game.lua
    – xax
    Commented Sep 8, 2023 at 7:50
  • oh sorry i decrypt the wrong folder. Thanks a lot to help me with this. I'll comeback and up vote for you when i can
    – NoName
    Commented Sep 8, 2023 at 7:54
  • um, i decrypt the game.lua now and removed XXTEA header but the xxtea on python still said it's the wrong key. Can u tell me what thing did u use to decrypt?
    – NoName
    Commented Sep 8, 2023 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.