{"id":18574175,"url":"https://github.com/su-vikas/conbeerlib","last_synced_at":"2025-07-10T11:14:24.073Z","repository":{"id":84757373,"uuid":"277261225","full_name":"su-vikas/conbeerlib","owner":"su-vikas","description":"Android library for detecting Android virtual containers.","archived":false,"fork":false,"pushed_at":"2020-12-12T16:48:15.000Z","size":6095,"stargazers_count":68,"open_issues_count":5,"forks_count":18,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-10T20:56:46.001Z","etag":null,"topics":["android"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/su-vikas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-07-05T08:29:58.000Z","updated_at":"2024-12-20T10:32:12.000Z","dependencies_parsed_at":"2023-03-06T21:00:22.926Z","dependency_job_id":null,"html_url":"https://github.com/su-vikas/conbeerlib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/su-vikas/conbeerlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/su-vikas%2Fconbeerlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/su-vikas%2Fconbeerlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/su-vikas%2Fconbeerlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/su-vikas%2Fconbeerlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/su-vikas","download_url":"https://codeload.github.com/su-vikas/conbeerlib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/su-vikas%2Fconbeerlib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264569492,"owners_count":23629605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android"],"created_at":"2024-11-06T23:14:15.090Z","updated_at":"2025-07-10T11:14:23.526Z","avatar_url":"https://github.com/su-vikas.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# conbeerlib\n\n*conbeerlib* is an Android library for detecting if an app is running inside a **virtual container**.  \n\nThis is based on the work done by me and [Gautam](https://github.com/darvincisec), presented at [Android Security Symposium 2020](https://android.ins.jku.at/symposium/program/) - [slides](android_virtual_containers_slides.pdf).\n\nThis repo contains *conbeerlib* and a wrapper application, *conware*, which we used for our research.\n\n# Checks\n\nCurrently following checks are implemented: \n\n1. Permissions in Manifest - There can be a mismatch between the permissions granted and originally requested by an application. \n2. Process Memory - Check */proc/self/maps* for presence of artifacts not belonging to the app's expected filepath. \n3. Storage Dir - The assigned storage path for an app inside virtual container is different, as compared to when installed directly on Android device. \n4. Environment Variables - Virtual containers set various environment variables.\n5. Running App Services - There can be other services running than what started by an application.\n6. App Components - Enable app components dynamically may not always work in virtual containers. \n\n# Usage\n\n```Java\nConBeer cb = new ConBeer(context, appServiceNames);\nif (cb.isContainer()) {\n    // container is present\n}else{\n    // container not present\n}\n```\n\nAdd 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. \n\n```Java\nComponentName componentName = new ComponentName(this.getApplicationContext(), FakeBroadcastReceiver.class);\nthis.getPackageManager().setComponentEnabledSetting(componentName,\n        PackageManager.COMPONENT_ENABLED_STATE_ENABLED,\n        PackageManager.DONT_KILL_APP);\n```\n\n# Limitations\n\nThis 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. \n\nPlease feel free to open an issue when you encounter such problems.\n\n\n# References\n\n1. [ANTI-PLUGIN: DON’T LET YOUR APP PLAY AS AN ANDROID PLUGIN](https://www.blackhat.com/docs/asia-17/materials/asia-17-Luo-Anti-Plugin-Don't-Let-Your-App-Play-As-An-Android-Plugin-wp.pdf) \n2. [Android Plugin Becomes a Catastrophe to Android Ecosystem](https://dl.acm.org/doi/10.1145/3203422.3203425)\n3. [Parallel Space Traveling: A Security Analysis of App-LevelVirtualization in Android](https://dl.acm.org/doi/pdf/10.1145/3381991.3395608)\n\n\n# License\n\nThis project is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsu-vikas%2Fconbeerlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsu-vikas%2Fconbeerlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsu-vikas%2Fconbeerlib/lists"}