Detection of ADB Status
ADB (Android Debug Bridge) is a means of communication between Android devices and computers. It allows computer to connect to the device over USB or WiFi. A connected computer is able to send various commands and data to the device or extract data from it.
ADB is expected to be enabled on development devices but shouldn’t be enabled on devices of common users.
Malwarelytics for Android is able to detect when ADB is enabled on the device.
Configuration
This feature can be configured during the Malwarelytics initialization phase:
val raspConfig = RaspConfig.Builder()
.exitOnAdbEnabled(Boolean)
.exitOnAdbEnabledUrl(String)
// configuration of other RASP features
.build()
Method | Description |
---|---|
exitOnAdbEnabled(Boolean) |
indicates whether the app should be terminated when ADB (Android Debug Bridge) is enabled on the device. Defaults to false . |
exitOnAdbEnabledUrl(String) |
defines a URL to be opened when the app is terminated because of detection of enabled ADB. Defaults to null . |
Usage
After initialization, the ADB status check feature can be accessed via RaspManager
. This can be used to register an observer or to trigger a manual ADB status check.
Registering an Observer
ADB status check can trigger a certain action. To achieve that, an observer needs to be configured and registered.
Observer configuration:
val raspObserver = object : RaspObserver {
override fun onAdbStatusDetected(adbStatus: Boolean) {
// handle ADB status detection
}
// handle detection of other RASP features
}
The observer can be registered in RaspManager
. When it is no longer needed, it can be unregistered again.
raspManager.registerRaspObserver(raspObserver)
raspManager.unregisterRaspObserver(raspObserver)
Triggering a Manual Check
ADB status check can be triggered manually in RaspManager
by calling the isAdbEnabled()
method. A simple boolean answer is given.
val isAdbEnabled = raspManager.isAdbEnabled()
More information on general RASP feature configuration and usage can be found in this overview.