FreeRASP causes Runtime.getRuntime().exec("ping -c 1 www.google.com") to throw an error
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
Hi @gamalkhaled-breadfast,
thanks for opening the issue. We reproduced the bug and will work on fix.
Best, Tomas, Talsec developer
Hi @gamalkhaled-breadfast , the bugfix is ready, patch should be available in the next release. Best, Tomas & Talsec team