ADB enabled detection [Android devices only]

ADB (Android Debug Bridge) Enabled is a power-user feature activated through the "USB Installation" option in the Developer settings. This state can signal potential security risks, such as apps being installed via USB, the device being connected to a man-in-the-middle (MiTM) proxy, or the device running as an emulator. When ADB is enabled, it allows extensive access to the device, including pulling and pushing files, issuing shell commands, working with the activity manager (e.g., starting activities, broadcasting intents, modifying hidden Android settings, attaching a profiler to a process, or making an app debuggable), and managing packages. Additionally, it enables capturing screenshots, recording the screen, and other actions that can compromise app security and user privacy. FreeRASP detects whether the USB debugging is enabled.

Below are code snippets demonstrating ADB enabled detection across various platforms:

// Android ADB enabled detection
override fun onADBEnabledDetected() {
    TODO("Not yet implemented")
}

// Flutter ADB enabled detection
onADBEnabled: () => print("Developer mode detected")

// Cordova ADB enabled detection
adbEnabled: () => {
    // Place your reaction here
}

// React Native ADB enabled detection
adbEnabled: () => {
    // Place your reaction here
}

// Capacitor ADB enabled detection
adbEnabled: () => {
    // Place your reaction here
}

Recommended action: Log the event on your BE

Last updated