darvincisec / DetectFrida

Detect Frida for Android
MIT License
665 stars 138 forks source link

Crash on freeing a non null pointer on non-rooted devices when installed as AAB #2

Closed talk2cerlin closed 3 years ago

talk2cerlin commented 4 years ago
Steps to reproduce:
  1. Set android app config to Deploy: APK from app bundle
  2. Run the app on non rooted device.
Issue:

char* filePaths[NUM_LIBS] is not set to null by default and on non-rooted devices, it s not getting filled with file path pointer. If the app is deployed from bundle, this variable gets filled with some random garbage address. Since we have only null check before freeing the memory, the code tries to free some random garbage address and crashes.

This works fine with rooted devices and if the app is deployed as apk on non-rooted devices

Solution:

Set a default null char to the array values like, char* filePaths[NUM_LIBS] = {'\0'};