conbeerlib is an Android library for detecting if an app is running inside a virtual container.
This is based on the work done by me and Gautam, presented at Android Security Symposium 2020 - slides.
This repo contains conbeerlib and a wrapper application, conware, which we used for our research.
Currently following checks are implemented:
ConBeer cb = new ConBeer(context, appServiceNames);
if (cb.isContainer()) {
// container is present
}else{
// container not present
}
Add following code in onResume()
method of your application. This code is responsible for dynamically enabling a dummy app component, which is used for testing presence of virtual containers. The component is defined in conbeerlib's manifest file.
ComponentName componentName = new ComponentName(this.getApplicationContext(), FakeBroadcastReceiver.class);
this.getPackageManager().setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
This library is tested only with a limited number of virtual containers and may not be able to detect all them currently. Also, given the madness of Android device diversity, there is a good chance of false positives.
Please feel free to open an issue when you encounter such problems.
This project is released under the MIT License.