Free-RASP-ReactNative icon indicating copy to clipboard operation
Free-RASP-ReactNative copied to clipboard

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

Open gamalkhaled-breadfast opened this issue 1 year ago • 2 comments

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:

  • Device: Any Android device (tested example: OnePlus 8pro)
  • OS version: Any Android (tested example: Android 13, 10 and 11)
  • Version of freeRASP: "freerasp-react-native": "3.3.1"

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

gamalkhaled-breadfast avatar Jan 16 '24 12:01 gamalkhaled-breadfast

Hi @gamalkhaled-breadfast,

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

Best, Tomas, Talsec developer

tompsota avatar Jan 16 '24 15:01 tompsota

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

SirionRazzer avatar Aug 08 '24 14:08 SirionRazzer