2

I am trying to find the encryption key for a lua file from a .so file But I am new in this field. I visit websites and found that key is inside xxteaDecrypt function I found two xxteaDecrypt function.

First xxteaDecrypt function

__int64 __fastcall xxtea_decrypt(const unsigned __int8 *a1, unsigned int a2, const unsigned __int8 *a3, size_t a4, unsigned int *a5)
{
  char *v10; // x24
 __int64 v11; // x19

 *a5 = 0;
 if ( a4 > 0xF )
return sub_91716C(a1, a2, a3, a5);
 v10 = (char *)amt_malloc(0x10u);
 memcpy(v10, a3, a4);
 memset(&v10[a4], 0, 16 - a4);
 v11 = sub_91716C(a1, a2, v10, a5);
 amt_free(v10);
 return v11;
}


Second xxteaDecrypt function

__int64 __fastcall encryption::xxteaDecrypt(encryption *this, void *a2, char *a3, const char *a4, unsigned int *a5)
{
  unsigned int v8; // w21
  __int64 result; // x0
  unsigned int v10; // [xsp+4h] [xbp-3Ch] BYREF
  __int64 v11; // [xsp+8h] [xbp-38h]

  v11 = *(_QWORD *)(_ReadStatusReg(ARM64_SYSREG(3, 3, 13, 0, 2)) + 40);
  if ( !a3 )
  {
    __amt_assert(
      "/Users/user/jenkins/workspace/BFG/BFG-android/AMTEngine/native/tools/encryption/encryption.cpp",
      (char *)((unsigned int)&qword_28 + 4),
      "keyExactly16Characters && strlen(keyExactly16Characters) == 16",
      0);
    return 0LL;
  }
  v8 = (unsigned int)a2;
  if ( strlen(a3) != 16LL )
    __amt_assert(
      "/Users/user/jenkins/workspace/BFG/BFG-android/AMTEngine/native/tools/encryption/encryption.cpp",
      (char *)((unsigned int)&qword_28 + 4),
      "keyExactly16Characters && strlen(keyExactly16Characters) == 16",
      0);
  if ( strlen(a3) != 16LL )
    return 0LL;
  v10 = 0;
  result = xxtea_decrypt((const unsigned __int8 *)this, v8, (const unsigned __int8 *)a3, 0x10u, &v10);
  if ( a4 )
    *(_DWORD *)a4 = v10;
  return result;
}

Signature - amta

link of so file - https://mega.nz/file/IKhl1aTY#YAh5SXwLTKuEWZkY1ZO8BCfv9yz-TAN9bW-z6h5PS7M

Please help me to get the key. I am trying from a long time

4
  • Hi, welcome to R.E. Please share your progress made so far with encryption keys particularly decryption function.
    – Viktor
    Jan 21, 2023 at 4:09
  • Ok I am writing xxteaDecryption function
    – Ritesh
    Jan 21, 2023 at 9:53
  • Have you tried to hook the methods using Frida.re? If the program delivers you the encryption key for free and you can execute it manually you don't need to understand the method code, just what arguments are expected.
    – Robert
    Jan 22, 2023 at 12:13
  • No, I can't understand your last sentence Means I have to find out the arguments of this function
    – Ritesh
    Jan 23, 2023 at 16:08

0

Your Answer

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

Browse other questions tagged or ask your own question.