talsec / Free-RASP-ReactNative

React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.
https://github.com/talsec/Free-RASP-Community
MIT License
84 stars 10 forks source link

FreeRASP causes Runtime.getRuntime().exec("ping -c 1 www.google.com") to throw an error #41

Closed gamalkhaled-breadfast closed 3 days ago

gamalkhaled-breadfast commented 8 months ago

Describe the bug A third-party library we use uses Runtime.getRuntime().exec("ping -c 1 www.google.com") in Android(Java) to check the internet connection status, but when we initialize freeRASP throw useFreeRasp with only console.log for every action, the line throws an error java.io.IOException: Cannot run program "ping": error=2, No such file or directory .

To Reproduce Add this function to an android module and expose it to the JS, initialize freeRASP then call the function

public Boolean isOnline() {
  try {
    Process p1 = Runtime.getRuntime().exec("ping -c 1 www.google.com");
    int returnVal = p1.waitFor();
    boolean reachable = (returnVal == 0);

    Log.e("CONNECTION STATUS:", reachable ? "Reachable" : "Not Reachable");
    return reachable;
  } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return false;
}

Expected behavior isOnline should return true, as it does if we only commented useFreeRasp

Please complete the following information:

Aditional Context The command works if we changed ping to /system/bin/ping

tompsota commented 8 months ago

Hi @gamalkhaled-breadfast,

thanks for opening the issue. We reproduced the bug and will work on fix.

Best, Tomas, Talsec developer

SirionRazzer commented 1 month ago

Hi @gamalkhaled-breadfast , the bugfix is ready, patch should be available in the next release. Best, Tomas & Talsec team