You are on page 1of 10

SPECIAL SECTION ON SECURITY AND PRIVACY IN EMERGING DECENTRALIZED

COMMUNICATION ENVIRONMENTS

Received November 9, 2019, accepted November 29, 2019, date of publication December 10, 2019,
date of current version December 23, 2019.
Digital Object Identifier 10.1109/ACCESS.2019.2958837

Salaxy: Enabling USB Debugging Mode


Automatically to Control Android Devices
HUI LU 1 , XIAOHAN HELU 1 , CHENGJIE JIN 1, YANBIN SUN 1,

MAN ZHANG 2 , AND ZHIHONG TIAN 1


1 Cyberspace Institute of Advanced Technology, Guangzhou University, Guangzhou 510006, China
2 Peng Cheng Laboratory, Shenzhen 518055, China
Corresponding authors: Yanbin Sun (sunyanbin@gzhu.edu.cn) and Man Zhang (zhangm@pcl.ac.cn)
This work was supported in part by the Guangdong Province Key Area Research and Development Program of China under
Grant 2019B010137004, in part by the National Natural Science Foundation of China under Grant 61972108, Grant U1636215, and
Grant 61572153, in part by the National Key research and Development Plan under Grant 2018YFB0803504, and in part by the
Guangdong Province Universities and Colleges Pearl River Scholar Funded Scheme (2019).

ABSTRACT Android system attackers have proposed various attack schemes to invade users’ privacy. One
way is to use ADB (Android Debug Bridge) with advanced permissions but low protection. In order to set up
an ADB connection successfully, the USB debugging option of the target device must be turned on. However,
the existing ADB-based attack schemes have not proposed how to enable the USB debugging, so it couldn’t
be considered that their attack chain is completable. This paper presents an approach for attacking Android
devices by exploiting JavaScript to enable USB debugging automatically in the device’s system settings,
which fills in the gaps of existing solutions. This method can bypass the security mechanism of USB debug-
ging mode and obtain an ADB connection without the user’s authorization. It can also bypass the alerts that
ADB Action Monitor displays when sensitive behaviors are detected. Based on AccessibilityService, Auto.js
and Scrcpy, an application called Salaxy is designed and implemented to demonstrate the effectiveness of
this method. Besides, Salaxy can monitor and manipulate Android devices remotely.

INDEX TERMS ADB, android, attack, security, smartphone, USB debugging, vulnerability.

I. INTRODUCTION In fact, the privacy of Android users has been challenged


With the rapid development of Internet technology, various by various malware and attacks, such as Soundcomber [9],
new application technologies and patterns are emerging that which extracts a small amount of sensitive information from
people’s lives more convenient, such as the introduction of the audio sensor; TouchLogger [10], which exploits the side
edge computing [1], [2], substantial improvements on the channel to infer keystrokes; SimBad [11], which is hidden
efficiency of network services; the development of wireless in the Google Play Store for users to download and install.
sensors [3] and the improvement of sensor network manage- To avoid malicious activities, Google has taken some security
ment schemes [4]–[6], making the Internet of Things (IoT) measures, such as developing anti-malware software, such as
more practical and driving the development of Internet of Malwarebytes [12], detecting malicious applications in the
Vehicles (IoV) and its security solutions [7]. The decentral- Google Play Store more rigorously, and using sandboxes to
ized mode brought by blockchain technology has provided restrict software access to the system; each of these measures
novel security thinking for network data [8], and the emer- have limited malware attacks to some extent.
gence of mobile smart devices has subverted the status of tra- However, attackers are constantly exploring new solutions
ditional computers on the Internet and has also brought about to challenge Android security design. ADB is a multipur-
tremendous changes to human lifestyles. pose command-line tool that allows the developer to com-
Today, mobile smart devices are rapidly gaining popularity. municate with the connected Android device through a USB
The Android OS (operating system) developed by Google is cable. ADB provides many functionalities, including file
one of the major OSs for mobile devices. Its open-source and transfer, shell access, application installation and debugging,
extensible features make it attractive and competitive, but at and port forwarding. ADB very effectively allows applica-
the same time, they easily attract the attention of attackers. tion developers to obtain maximum privileges on Android
smart devices, which draws the attention of attackers.
The associate editor coordinating the review of this manuscript and
The first malware to exploit ADB resource exhaustion was
approving it for publication was Maurizio Tucci. DroidDream [13], which sends malware to Android devices

This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see http://creativecommons.org/licenses/by/4.0/
VOLUME 7, 2019 178321
H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

by installing a rootkit on the device. Hwang et al. [14] The Salaxy sever is controlled by the attacker, and the client
presented some feasible, stealthy attacks that can be per- is installed on the victim’s Android phone. Salaxy can exe-
formed with ADB. Windows malware [15] attempted to cute preset scripts to enable USB debugging, connect to the
infect Android devices to steal private data used ADB as its server, and then monitor and manipulate the victim’s Android
main tool. Amarante et al. [16] have already identified three smartphone. The method is simple, easy and does not need to
attack scenarios based on the use of ADB and developed avoid the phone’s anti-virus software and is suitable for the
proof-of-concept scripts that can extract private data from Android versions 5.0 or higher.
a USB-connected device connected to a computer. Weizhi We propose an attack method for Android devices that
Meng et al. designed a new type of charging attack, called a effectively monitor and manipulate Android phones.
juice filming attacks [17], based on a standard USB connec- We design and implement Salaxy, a proof-of-concept
tor and an HDMI port, which is able to steal users’ private application, to demonstrate this approach.
data through automatically video-capturing their inputs with- Salaxy combines harmless software(Auto.js and Scrcpy) to
out drawing the attention of users. Reference [18] proposed perform a malicious task. It is simple and easy to implement
a scheme for obtaining the system application logs using and will not alert anti-virus software.
ADB to perform hijacking attacks. It could be seen that many We add an induced interface to Auto.js. The induced inter-
attacks against the Android system exploit the vulnerabilities face is just a simple UI (User Interface) to communicate with
of the ADB tool—if no proper protection of ADB has been the Salaxy Server and does not require sensitive permissions.
enforced when using a USB connection, it may compromise We modify the socket of Auto.js so that it automatically con-
the privacy of smart device users. Consequently, Google has nects to Salaxy Server each time it starts.
strengthened the protection of ADB, and USB debugging We develop two kinds of automated JavaScript scripts to
mode is disabled by default and has to be explicitly enabled in turn on the USB debugging mode(customized and generic)
the developer options menu. To prevent unauthorized access that are stored on the server-side and do not require the user
via the ADB protocol, secure USB debugging was introduced to download. The scripts will not attract the attention of the
in Android version 4.2.2. [19]. A requirement was added user when they run.
that each ADB session has to be authenticated. This secu- We test the Salaxy on Huawei Honor 10, OnePlus6 and
rity mechanism ensures that USB debugging and other ADB Xiaomi 6X phones, proving that Salaxy can video-capture
commands cannot be executed unless the user can unlock the and manipulate the target phone whose version is Android
device and acknowledge the dialog. 5.0 or higher.
The three attack scenarios proposed by Amarante et al. [16]
clearly noted that the attack will succeed only if USB debug- II. BACKGROUND
ging is enabled. Turning on USB debugging is quite com- A. ACCESSIBILITYSERVICE [23]
plex. First, developer mode must be opened, as the developer Accessibility services provide UI enhancements to assist
options screen is hidden by default. To make it visible, go to users with disabilities in using Android devices and apps.
Settings > System > About phone, tap Build number seven They run in the background and receive callbacks by the
times [20] and enter the lock screen password. Return to the system when AccessibilityEvents are fired. Development of
previous screen to find Developer options at the bottom. Next, an accessibility service requires extending the Accessibil-
tap Developer options, and then tap USB debugging. When ityService class and implementing its abstract methods—
the Android device is connected to an unknown host, the sys- onAccessibilityEvent() and onInterrupt(). These two meth-
tem will display a dialog window asking whether to accept an ods will always run in the background once the service is
RSA (Rivest–Shamir–Adleman) key that allows debugging started. When the UI changes, an AccessibilityEvent is gen-
through this computer and needs to be confirmed. How to erated which contains the type of object being acted upon,
convince users to perform these operations is a problem that the descriptive text, etc. An accessibility service gets informa-
cannot be ignored. In fact, a way to enable secure USB debug- tion about a UI event through the onAccessibilityEvent() call-
ging is not given in the above solutions and other ADB-based back method. Then, the onAccessibilityEvent() is executed to
attacks. Therefore, this mechanism seems to be very effective implement the function customized by a developer.
in preventing ADB-based attacks. Google’s motivation in developing Accessibility services
This paper presents an approach to enable USB was to assist users with disabilities, such as visual impair-
debugging automatically in Android devices based on ments, color vision impairments, hearing loss, and mobility
AccessibilityService. This method can bypass the secu- issues. However, its powerful features also provide conve-
rity mechanism of USB debugging mode and bypass the nience for attackers. This paper takes advantage of the func-
improved security mechanism design of USB debugging tions of Accessibility services to turn on USB debugging
mode, which was proposed in [21]. An attack model, mode automatically. This inspiration comes from the work
called Salaxy, is implemented. Salaxy is based on the of Tian et al. [22], they navigated to the settings menu using
C/S (client/server) architecture, combining Auto.js and touchscreen automation and allow USB debugging from their
Scrcpy (i.e., the two usual open-source software programs). attacking machine

178322 VOLUME 7, 2019


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

B. AUTO.JS [24] D. THREAT MODEL


Auto.js is an open-source JavaScript automation program Throughout the paper, we assume an extra public USB charg-
running on the Android platform that does not require root ing station controlled by an attacker, tries to attack the con-
access. The functionality of Auto.js is based on Accessibil- nected Android device through a USB cable. We assume
ityService. It provides functions such as data monitoring, that Salaxy is disguised as a software that provides some
image monitoring, widget operating and automated workflow kinds of functionality (such as a charging manager used with
(through running a script), which is similar to UIAutomator, the charging station), and the victim downloads and installs
Google’s UI testing framework, but doesn’t require a com- Salaxy for their own needs. We assume that the target phone
plicated environment configuration like UIAutomator. You provides the Allow ADB debugging in charge only mode
just need to install Auto.js on your Android device to use it. option in the system settings (which could find in Huawei
In addition, by binding your computer’s IP (Internet Protocol) phones and it is easy for us to turn it on via running a remote
address to Auto.js (one of the features that Auto.js provides), script). If not, we assume that when Salaxy prompts the user
you can operate your computer to make Android devices exe- to select ‘‘MTP’’ mode when charging, the user will do so.
cute remote scripts. We developed Salaxy based on Auto.js, The threat model is appropriate because any malware tricks
augmented an induced interface, and changed the value of the victims into installing and activating itself by providing users
IP address variable to a fixed one (the attacker’s IP address) with features they want or displaying some discount ads. The
at the code level. In other words, you could bind Auto.js to threat model is based on the users’ obey consciousness. When
any IP address you want but in Salaxy, it will automatically users need the features of the software, they often follow the
be bound to the attacker’s IP address. software’s prompts to operate the mobile phone.

C. SCRCPY [25]
Scrcpy is an ADB-based command-line tool that displays
and controls Android (version 5.0 and higher) devices con-
nected through a USB cable or over TCP/IP (Transmission
Control Protocol/Internet Protocol). It works without any root
access but requires USB debugging on in the system set-
tings. Scrcpy is for GNU/Linux, Windows and Mac OS. Once
the Android device is connected to a computer with Scrcpy
installed by a USB cable, the Android device screen can be
viewed on the computer and the screen status changes can be
synchronously received. The computer mouse, keyboard and
other control devices can also be used to operate the Android
device. FIGURE 2. The Allow ADB debugging in charge only mode option in
Huawei Honor phones.
In our attack process, after opening USB debugging mode
through running a remote script, we will launch Scrcpy
to manipulate Android phones. The final effect is shown III. DESIGN & IMPLEMENTATION
in Figure 1. By combining AccessibilityService’s ability to monitor the
UI events of Android phones and act on behalf of users,
Auto.js’s ability to run scripts automatically and Scrcpy’s
ability to capture phone screens in real time, Salaxy can
turn on USB debugging mode and then monitor and manipu-
late the victim’s device without being detected by anti-virus
software. Salaxy consists of multiple components as shown
in Figure 3. What we have to be aware of is that the Auto.js
client has been bound to the Auto.js debugging terminal con-
trolled by an attacker. Our attack procedure using Salaxy is
divided into five steps:
1) When the user clicks on Salaxy Client, first he will see
the induced interface which prompts him to enter the
lock screen password, and then he does it. So the Salaxy
Server could receive the password from the client.
2) After entering the password, the Auto.js client interface
is displayed. The user turns on the AccessibilityService
according to the prompt of Auto.js.
FIGURE 1. Effect of running Scrcpy. If the Allow ADB debugging in charge
only mode option is on, Scrcpy can monitor the phone without the ‘‘MTP’’ 3) The attacker uses auto.js debugging terminal to
mode. remotely execute scripts stored on the attack side.

VOLUME 7, 2019 178323


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

4) When scripts finish running, the USB debugging of the point class to display the icon, which is the dot in the nine-
Android phone will be turned on. square grid. It stores some attributes, such as the position
5) The attacker runs Scrcpy on the attacker side to manip- of the top, bottom, left, and right of the current point, the
ulate the victim’s phone. state of the point, and its index. 2) Draw the pattern area.
It should be noted that we don’t require the USB cable Define a GesturePsdView class to draw the nine-square grid,
connected before step 5. In fact, the first four steps could be and add nine point-type objects to represent the nine icons.
completed in the wireless connection. In this class, the color of the selected point and the color
of the line are defined. 3) Draw the gesture path. Override
the onTouchEvent() method, which listens to TouchEvent
events such as ACTION_DOWN, ACTION_MOVE, and
ACTION_UP events to record the path when the user con-
nects different points by drawing. 4) Obtain the pattern.
Salaxy determines the position of the point that the user’s fin-
ger touches, records the index of each point with the ‘‘index’’
attribute, and then saves the index of the touched point in
sequence according to the point that the user’s gesture passes
(from top to bottom, the order of the points is 1, 2, 3, 4, 5, 6, 7,
8, 9). The entire recorded process does not allow point repeti-
tion. Finally, a sequence of user connection points is obtained
and sent to the server. Salaxy Client writes data to the socket
through a DataOutputStream class, the Salaxy Server receives
FIGURE 3. A graphical depiction of our attack process based on Salaxy. the stream through DataInputStream, and then uses the read-
UTF() method to read the data. As a result, the Salaxy Server
Salaxy Server starts the service listener and waits for the receives the plaintext password entered by the user.
client to connect. The MainActivity class of Salaxy Client
implements the Runnable interface, which defines the IP B. SCRIPT LOGIC DESIGN
address of Salaxy Server and port. When the user starts the For security reasons, developer mode on the Android system
Salaxy Client, it will instantiate a Socket (Salaxy Server’s IP is disabled by default, and it cannot be opened by means such
address, port) and request to connect to the Salaxy Server, as executing system commands in the background. Navigate
then the client and server communicate through a socket. to the settings menu using the touchscreen and click it is the
At the same time, the Induced interface is shown. only way to enable it. To prevent users from accidentally turn-
ing on developer mode, Android hides this option from the
A. INDUCED INTERFACE system settings menu. Take the Huawei Honor series smart-
For most Android smartphones, enabling developer mode phones as an example. The way to turn on USB debugging
requires a password if the lock screen password is set. Cur- mode is to go to Settings > System > About phone, select
rently, most smartphone users have set a lock screen pass- Build number seven times, enter the lock screen password,
word. Only a small number of disabled or elderly people return to the previous screen, and tap Developer options >
have not. Therefore, obtaining the lock screen password of USB debugging. A dialog window appears with ‘‘Allow USB
a victim’s smartphone is a very important part of the attack debugging?’’: click OK. Apparently, turning on USB debug-
process. The appearance of the induced interface comes from ging mode is a tedious process that requires human interven-
the phone’s lock screen interface. It is the first interface tion. Therefore, USB debugging mode is difficult to exploit
shown when running Salaxy, which prompts a user to enter in traditional attack scenarios.
his lock screen password. This link is a deceptive method, not The method presented in this paper is based on Accessi-
a technical one because the interface is just used to obtain the bilityService and Auto.js. We wrote simple scripts that con-
password entered by the user instead of performing the pass- vert the above operations into automation. We investigated
word verification. This design is based on many observations. the methods of turning on USB debugging mode for differ-
As people become more reliant on smartphones, mobile users ent brands Android smartphones, such as Huawei, OnePlus,
frequently unlock their phone screens every day, so they are Xiaomi, Vivo, Meizu, and Coolpad, and found that they are
often not too sensitive to software behaviors that require a similar. One of the differences between these devices is the
lock screen password. password verification for opening developer mode. In the
The interface provides a 4-digit password option and a ges- above brands, Xiaomi and Meizu smartphones do not require
ture one. There are four input boxes set in the 4-digit pass- a password when turning on developer mode, which makes
word interface. When the user enters four numbers, they will the attack easier. The other difference is the locations of
be sent to the Salaxy Server. The pattern interface provides a smartphone options, such as the System option of a Huawei
nine-square (3∗ 3) grid. The implementation of this interface smartphone, which is located at the bottom of the Settings
is mainly divided into the following parts:1) Icon. Define a menu (we need to scroll down to find it). However, it is at

178324 VOLUME 7, 2019


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

the top of the Xiaomi smartphone so that we can omit the user. To make the changes of the phone’s UI hidden from the
scrolling operation. This paper takes a Huawei smartphone user, we will open an opaque floating window when the script
as an example to illustrate the implementation of turning starts and close it after the USB debugging is successfully
on developer mode, as Huawei smartphones have the most turned on. Figure 4 illustrates when the floating window is
complicated steps, requiring screen scrolling and password opened and closed.
verification. The complete operation of allowing USB debug-
ging for Huawei mobile phone is Settings - System - About C. SCRIPTWRITING
Phone - click ‘‘Build Number’’ 7 times - System - Developer Auto.js provides two methods to click on an option in the
Option - USB debugging - OK. The script behavior is shown smartphone menu: widget-based and coordinate-based oper-
in Figure 4. ations.

1) WIDGET-BASED OPERATIONS
A widget-based operation refers to selecting a widget on the
screen and getting its attributes or manipulating it. Generally,
widget-based operations have good compatibility with differ-
ent smartphone models. The general software interfaces are
composed of many widgets; for example, the image part is a
picture widget (ImageView), and the text part is a text widget
(TextView). A widget has various attributes, including text
(text), description (desc), class name (className), and id.
We usually use some attributes of the widget to search for it,
show in List1.

List 1 Searching for the Settings Widget


//Searching for the Settings widget
Find (‘‘Settings’’ widget) {
widgetsSet = widgets with the class name
‘‘android.widget.TextView’’ in the current view;
targetWidget = a widget with the word ‘‘Settings’’ in
widgetsSet;
Looking for the ‘‘Settings’’ widget in the current view{
If (found):
FIGURE 4. Process of the script for turning on USB debugging. The
process will be hidden below an opaque floating window. Return an object of the targetWidget;
Else:
Under the condition that USB debugging is allowed, when
Return false;
the user connects his mobile phone to the USB cable,
Wait for the view to change and look for it again;
the Android system will detect whether the currently con-
}
nected host is in the whitelist for ADB of the mobile phone,
}
if not, a dialog box will be displayed to ask whether to accept
the RSA key that allows debugging through this host, and OK
Salaxy’s script uses the class name attribute to search for
must be selected. The Salaxy script will continuously monitor
the Settings widget, and the click() method is used to click on
the OK widget. Once the dialog that requires user confirma-
it, as shown in List 2:
tion appears, it will be confirmed by the script immediately
so that the user has no time to check and stop it. The script
List 2 Tapping the Settings Widget
behavior is shown in Figure 5.
//Tapping the Settings widget
If (Find (‘‘Settings’’ widget) = an object of the Settings
widget):
Do click();
Else:
Unable to click;

Some widgets have a clickable attribute of false, which


means that they cannot be tapped through the click() function.
FIGURE 5. Process of the ADB authorization confirmation script.
Thus, we should call the bounds() function to obtain their
The UI of the mobile phone changes according to the exe- coordinates and then click on the coordinates. For example,
cution of a script, which will easily attract the attention of the if we need to click on the System and About phone widgets,

VOLUME 7, 2019 178325


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

we cannot call click() directly but rather bounds(). The pseu- size of each mobile phone is different, resulting in differ-
docode is shown in List 3. ent coordinate data for the same position, so the universal-
ity of the coordinate-based method is worse than that of
List 3 Obtain the Coordinates of the System Widget and Click the widget-based method. However, the advantage of the
on It coordinate-based method is that we do not need to consider
// Obtain the coordinates of the System widget and click the clickable attribute of the widget. The script can perform
on it the click operation with given only the coordinates. In this
targetWidget=Find(‘‘System widget’’); experiment, the numeric keypad of the OnePlus6 smartphone
coordinates = targetWidget.bounds(); is not a widget. We need to click Next in the lower-right
x-axis = coordinates.right; corner of the keyboard when the password is entered. The
y-axis = coordinates.centerY(); solution is shown in List 6.
click(x-axis,y-axis);
List 6 Click on the Location Where the Coordinates Are (900,
If the widget we are looking for does not exist in the current 1760)
view, we need a swipe operation to scroll down the phone
// Click on the location where the coordinates (900, 1760)
screen, which is achieved by scrolling down the list widget
are
named ‘‘android.support.v7.widget.RecyclerView’’. The list
Set the parameter of the phone screen size to (1080, 1920);
widget itself provides a scrollForward() method for users to
Call the method to click (900, 1760);
call. For example:
Affected by The resolution of the phone screen, the accu-
List 4 Scrolling Down racy of the coordinate-based method is slightly lower than
//Scrolling down that of the widget-based method. However, sometimes The
listWidget = Find (‘‘android.support.v7.\\ Widgets May Not be clickable. The widget-based and
widget.RecyclerView’’); coordinate-based methods Have Their Own Strengths. Our
Call scrollForward() method of listWidget{ solution uses the combination of the two methods to complete
swipe from the top of listWidgetto the bottom the script.
of it; The implementation of the floating window is very simple.
} auto.Js provides floaty.rawwindow() function to set floating
The final step in opening the developer mode is to enter windows. We only need to define an opaque floating window
the lock screen password, so when the build number has been object, setting its size to fill the screen. We could even set
tapped 7 times, the password verification interface will pop some text on the floating window as needed. for example:
up. For a text box widget, Auto.js provides a setText() func-
tion to input data. The password is entered via setText(): List 7 Set the Floating Window
// Set the floating window
List 5 Enter the Lock Screen Password floatyWin = floaty.rawWindow(
//Enter the lock screen password gravity = ‘‘center’’;
pwdWidget = Find (target widget with id pass- background color = ‘‘#FCFCFC’’;
word_entry); size = full screen;
password = ‘‘1111’’; // suppose the password we got from words = setText(
the induced interface is 1111 //set some words on floatyWin
setText(password) { gravity = ‘‘center’’;
Call the setText() method of pwdWidget; color = ‘‘black’’;
Enter ‘‘1111’’; text = ‘‘Loading. . . ’’;
} );
);
Make floatinWin Untouchable; // Prevent users from
2) COORDINATE-BASED OPERATIONS accidentally touching
In practice, we encounter some special cases. some wid- setTimeout{
gets not only have a clickable attribute of false but also Close floatinWin after 8 seconds;
do not provide the above-mentioned bounds() function to };
obtain the coordinates, or some elements of the UI cannot
be clicked because they are not a widget. for this reason,
the widget-based approach is not always efficient, and a IV. EVALUATION
coordinate-based approach is needed. A. SCRIPT EXECUTION SUCCESS RATE
Android smartphones take the point in the upper-left We take developer mode as an example. The number of wid-
corner of the screen as the coordinate origin. The screen gets needed to open developer mode is recorded as the path

178326 VOLUME 7, 2019


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

length. The actions that need to be performed during this which will reduce the success rate. However, to ensure com-
process are as follows: find the widget (Find), click the wid- patibility, the generic script must tolerate a drop in the success
get (Click), scroll the screen (Scroll) and input the password rate. We ran the generic script on three experimental subjects
(Write), which are known as F, C, S, W for short. According to at the same time and repeated the experiment 400 times. The
the path length and the action sequence, three most represen- results are shown in Figure 6. The main reason for the low
tative Android smartphones are selected as the experimental success rate of the generic script on OnePlus6 is that the path
objects: Huawei Honor 10, OnePlus6 and Xiaomi 6X. Their inconsistency causes the phone to perform additional opera-
developer mode startup path is as follows: tions.
Huawei Honor 10: go to Settings > System > About
phone, tap Build number seven times, and enter the lock
screen password. (path length: 5)
OnePlus6: go to Settings > About phone, tap Build num-
ber seven times, enter the lock screen password, and tap Next.
(path length: 5)
Xiaomi 6X: go to Settings > My device > All parameters,
and tap Build number seven times. (path length: 4)
The operation model abstracted from the paths above is
shown in Table 1.
FIGURE 6. The success rate of the custom script and the generic script.
TABLE 1. Operation analysis of turning on developer mode.
After developer mode is enabled, we will similarly perform
the script to enable USB debugging mode and then run Scrcpy
on the Salaxy Server to monitor and manipulate the victim’s
Android smartphone.
Many times the reason for the failure is that some target
widgets are located at the top of the interface of the phone
(such as About phone widget of Huawei and My device wid-
get of Xiaomi), so the script may accidentally tap the wrong
widget when the notification bar activates from the top.

B. TIME PERFORMANCE OF THE SCRIPTS


To verify the advantages of the scripting operations, we tested
the time required for manual operation and script execution
about turning on developer mode. We asked 200 testers to
Obviously, of all the types of mobile phones that have been manually open the developer mode for Android phones and
investigated, Huawei Honor 10 requires the most operations, then used the scripts to do the same for 200 times. In fact, after
while Xiaomi 6X requires the least. Moreover, it has been 100 attempts, we found that the time consumption of the three
observed in the experiment that the screen-scrolling opera- mobile phones basically stabilized. The results are shown
tion takes the most time, and the range of scrolling has to in Figure 7(we selected 100 experimental data for plotting).
be considered, which makes the success rate unsatisfactory.
In other words, the screen-scrolling operation can be consid-
ered to have the highest complexity. Considering that turning
on developer mode on the Xiaomi 6X does not require a lock
screen password, the success rate of the attacks on this system
should be the highest among the three.
We customized scripts to turn on developer mode automat-
ically for each experimental object and conducted 400 exper-
iments on each experimental object. After 100 experiments,
we found that the success rate distribution of the three mobile
phones basically stabilized. The results are shown in Figure 6.
However, in actual attacks, the brand of the victim’s smart-
phone is often uncertain. We observe the similarities and dif-
FIGURE 7. The time required for manual operation and script execution.
ferences among the paths of the three experimental objects
and then set up some branch paths in the script. Finally, It could be seen that running scripts can save two-thirds of
a generic script was generated to turn on three experimental the time compared to manual operations on the three experi-
subjects’ developer modes simultaneously. The disadvantage mental objects. The script for Xiaomi 6X has the best perfor-
of the generic script is that it needs to search for more widgets, mance.

VOLUME 7, 2019 178327


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

The Huawei and OnePlus smartphones take approximately 3) SMART NETWORK TVS
the same amount of time in manual operation because they IPTVs (Internet Protocol Televisions) [28] are a combination
have the same path length. Xiaomi takes the least amount of Internet and TV technology. They have been used on a
of time because no password verification is required. From large scale and are moving toward intelligence. Due to the
the test results of the script executions, the Xiaomi smart- portability of the Android system, most of the smart TVs
phone, which has the shortest path length and the least on the market today are Android-based. Smart IPTVs must
script actions, takes the least amount of time. The average rely on the network and a charging cable, which provides the
amount of time consumed by the Huawei and OnePlus phones possibility of a Salaxy attack.
are almost the same, but the stability of Huawei script is
better. B. SHORTCOMINGS OF SALAXY
Ultimately, we can conclude that the method of running a 1) ‘‘ CHARGE ONLY ’’ EFFECTIVENESS
script to turn on developer mode will greatly reduce the time One of the Salaxy’s drawbacks is that when the user selects
consumption. The shorter the path and the fewer the opera- ‘‘charge only’’ when charging, the fifth step of the attack
tions, the more efficient the script is. method(shown in Figure 3) will be ineffective, because Scr-
cpy, one of the components of Salaxy, requires ‘‘MTP’’ mode
V. DISCUSSION to monitor the phone. In the Threat Model(Section II-D),
A. APPLICATION SCENARIOS we assume that the target phone provides the Allow ADB
When applying the attack theory method into practice, debugging in charge only mode option in the system settings,
the real scene needs to be considered. We need to investigate but in fact, many brands of Android phones do not provide
the characteristics of a target victim and modify the UI or this option, so we still require the ‘‘MTP’’ mode selected by
functions of Salaxy according to those characteristics. the user. So whether the attack is successful depends on the
user’s vigilance against the security of the ‘‘MTP’’ mode.
1) USING SALAXY AT A PUBLIC CHARGING STATION
We propose the use of Salaxy at a public USB charging sta- 2) PROBABILITY OF CORRECT PASSWORD
tion, which is inspired by a juice filming attacks [17]; this The other weakness is whether we can receive the correct lock
method can automatically video-capture user inputs during screen password depends on the user’s input in the induced
charging, and the attackers can easily manually recover users’ interface. If the user just randomly enters a string of numbers,
private data, such as personal identification numbers (PINs) we won’t be able to open the developer mode of his phone
and email accounts, based on the recorded video. In our which will prevent subsequent attacks. Overall, getting the
approach, Salaxy is camouflaged as an app for use with correct password is a probability event.
charging stations. Before charging the device at a charging
station, users must install and register Salaxy. Less vigilant 3) EQUIRES HUMAN INTERVENTION
users will do so and connect the phone with a USB cable Besides, the integration of Auto.js and Scrcpy needs further
of the charging station. Then, we have a high probability improvement. The two separate functional modules must be
of turning on USB debugging mode in the victim’s Android connected through an ADB command. Executing this ADB
device and being able to set up a video transmission between command requires manual operation, but we hope to fully
the Salaxy server and the victim’s device. Compared with automate the attack process, which will be a challenge in the
juice filming attacks, Salaxy is able to bypass the security future.
mechanism of USB debugging mode and monitor the screen
of the victim’s devices without any hardware, such as the VI. RELATED WORK
VGA/USB interface. Furthermore, Salaxy can manipulate the Amarante et al. [16] identified three different scenarios and
device remotely, but juice filming attacks cannot. Last but not present three methods based on the use of the Android Debug
least, Salaxy can still maintain the connection via a TCP/IP Bridge tool to furtively extract private data from Android
connection after the user unplugs the USB cable from the mobile phones in those cases. In the first scenario, the mobile
charging station. phone whose Android version is 2.2 is rooted and its USB
debugging is on. In the second, the mobile phone with
2) DEPLOYED IN SMART CAMPUS INFRASTRUCTURES Android 4.0.4 is unrooted but its USB debugging is still on.
Smart campuses use technology and infrastructure to sup- In the third, the version is 5.0 with unrooted and the USB
port and improve campus services, teaching, learning, and debugging is off. However, it was not possible to extract data
research [26], which will greatly promote the reform and from the device in the third case. By contrast, Salaxy requires
innovation of the education model. Smart campuses provide neither root privileges nor an opened USB debugging.
campus network services, learning and research facilities to Tian et al. [29] surveyed and categorized USB host-related
teachers and students and maintain and manage many under- attacks. On their basis, Opasiak et al. [30] considered a
lying devices and their data [27]. For Salaxy, smart campuses broader spectrum of the USB-related attacks and evaluated
are a good place to hide probably. the security of the Secure USB debugging from the USB

178328 VOLUME 7, 2019


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

connectivity perspective. With the Secure USB debugging behaviors are detected. With this method, we designed and
mechanism, when the Android mobile device is connected to implemented a proof of concept application called Salaxy,
a given host for the first time, it requires a host authentica- which is composed of Auto.js and Scrcpy. Then, we demon-
tion. There is no data integrity mechanism in any other step strate the effectiveness of Salaxy on three different brands
of the ADB communication. They presented an approach to and models of Android smartphones. The results show that
compromise Android-based devices by exploiting the ADB Salaxy can remotely monitor and control Android devices in
protocol using Man in the Middle (MitM) attacks. They con- real time, allowing the attacker to manipulate the phone.
nected the victim’s phone to the attacker’s computer. When Today, people rely heavily on smartphones, which carry
the phone sends A_AUTH TOKEN, the attacker’s computer much work information and personal private data and have
forwards the message to the trusted host and captures a a very high correlation with personal property. The security
valid signature for this challenge. This signature will be sent risks of USB debugging undoubtedly threaten the security
back to the attacker’s host and then to the victim’s phone. of smartphone users. Some measures have to be taken to
Finally, the phone will authenticate the attacker’s computer enhance the security of USB debugging mode. In addition,
as a trusted host and grant access to all device resources. other Android-based electronic devices, such as smart TVs
However, this attack requires activation of USB debugging on (discussed in Section V-A), also need to strengthen the secu-
the mobile phone and requires physical access to the host that rity of USB debugging mode.
the victim previously trusted. That is, they did not propose a
way to turn on the USB debugging option automatically. ACKNOWLEDGMENT
Tian et al. [22] proposed a solution to bypass the Android The authors would like to sincerely thank all the reviewers
security mechanisms through AT commands. They found that for your time and expertise on this article. your insightful
AT commands accessed through the USB interface allow comments help us improve this work.
almost arbitrarily powerful functionality without any authen-
tication required. They retrieved 2,018 Android binary smart-
REFERENCES
phone firmware images and extracted 3,500 AT commands.
In the LG G4 mobile phone firmware image, the AT com- [1] Z. Tian, W. Shi, Y. Wang, C. Zhu, X. Du, S. Su, Y. Sun, and N. Guizani,
‘‘Real-time lateral movement detection based on evidence reasoning net-
mand to bypass the lock screen (AT%KEYLOCK=0) and the work for edge computing environment,’’ IEEE Trans. Ind. Informat.,
one to enable USB debugging (AT%USB=adb) were found. vol. 15, no. 7, pp. 4285–4294, Jul. 2019.
Once the attacker has bypassed the lock screen by the KEY- [2] Z. Tian, C. Luo, J. Qiu, X. Du, and M. Guizani, ‘‘A distributed deep
learning system for Web attack detection on edge devices,’’ IEEE Trans.
LOCK AT command, he could send touch events can to nav- Ind. Informat., to be published, doi: 10.1109/TII.2019.2938778.
igate the phone which connected to the attacker’s computer [3] X. Du and H. H. Chen, ‘‘Security in wireless sensor networks,’’ IEEE
through a USB cable to open the developer mode (the com- Wireless Commun. Mag., vol. 15, no. 4, pp. 60–66, Aug. 2008.
[4] X. Du, Y. Xiao, M. Guizani, and H.-H. Chen, ‘‘An effective key manage-
mand can also bypass the password authentication of devel- ment scheme for heterogeneous sensor networks,’’ Ad Hoc Netw., vol. 5,
oper mode), then send the USB debugging AT command. no. 1, pp. 24–34, 2007.
To the authors’ best knowledge there is no better method [5] Z. Tian, X. Gao, S. Su, and J. Qiu, ‘‘Vcash: A novel reputation
framework for identifying denial of traffic service in Internet of con-
to bypass the lock screen with minimal permissions and a nected vehicles,’’ IEEE Internet Things J., to be published, doi: 10.
high success rate. However, not every version of the Android 1109/JIOT.2019.2951620.
device provides the above two AT commands. [6] Y. Xiao, V. Rayi, B. Sun, X. Du, F. Hu, and M. Galloway, ‘‘A survey
of key management schemes in wireless sensor networks,’’ J. Comput.
Juice filming attacks, a charging attack designed by Commun., vol. 30, nos. 11–12, pp. 2314–2341, Sep. 2007.
Meng et al. [17], can steal users’ information by automati- [7] Z. Tian, X. Gao, S. Su, J. Qiu, X. Du, and M. Guizani, ‘‘Evaluating repu-
tation management schemes of Internet of vehicles based on evolutionary
cally taking videos, when they are interacting with the phones
game theory,’’ IEEE Trans. Veh. Technol., vol. 68, no. 6, pp. 5971–5980,
during the charging process, without causing user awareness. Jun. 2019.
They use a VGA2USB interface which is connected to a com- [8] Z. Tian, M. Li, M. Qiu, Y. Sun, and S. Su, ‘‘Block-DEF: A secure digital
evidence framework using blockchain,’’ Inf. Sci., vol. 491, pp. 151–165,
puter forming a malicious charger, and the computer then can Jul. 2019, doi: 10.1016/j.ins.2019.04.011.
automatically video-capture user inputs when the phone is [9] R. Schlegel, K. Zhang, X. Zhou, M. Intwala, A. Kapadia, and
connected to the charger. By contrast, Salaxy uses an easier X. Wang, ‘‘Soundcomber: A stealthy and context-aware sound trojan for
smartphones,’’ in Proc. NDSS, vol. 11, 2011, pp. 17–33.
model to construct the attack process, not only to record infor- [10] L. Cai and H. Chen, ‘‘TouchLogger: Inferring keystrokes on touch screen
mation as the Juice filming attack does, but also to simulate from smartphone motion,’’ HotSec, vol. 11, no. 2011, p. 9, 2011.
users’ operation. [11] Zdnet. Almost 150 Million Users Impacted by New SimBad
Android Adware. Accessed: Apr. 2019. [Online]. Available:
https://www.zdnet.com/article/almost-150-million-users-impacted-
VII. CONCLUSION by-new-simbad-android-adware/
This paper presents an approach to attack Android-based [12] Wikipedia. Malwarebytes (software). Accessed: Apr. 2019. [Online].
Available: https://en.wikipedia.org/wiki/Malwarebytes_(software)
devices by running JavaScript scripts to turn on USB debug- [13] A. G. Villan and J. Jorba, ‘‘Remote control of mobile devices in
ging mode. This method can bypass the security mechanism Android platform,’’ Oct. 2013, arXiv:1310.5850. [Online]. Available:
of USB debugging mode and obtain ADB connection autho- https://arxiv.org/abs/1310.5850
[14] S. Hwang, S. Lee, and Y. Kim, ‘‘Bittersweet ADB: Attacks and
rization without the user’s authorization. It can also bypass defenses,’’ in Proc. 10th ACM Symp. Inf., Comput. Commun. Secur., 2015,
the alerts that ADB Action Monitor displays when sensitive pp. 579–584.

VOLUME 7, 2019 178329


H. Lu et al.: Salaxy: Enabling USB Debugging Mode Automatically to Control Android Devices

[15] F. Liu. Windows Malware Attempts to Infect Android Devices. XIAOHAN HELU received the B.E. degree in
Accessed: Apr. 2019. [Online]. Available: http://www.symantec.com/ computer science and technology from the Bei-
connect/blogs/windows-malware-attempts-infect-android-devices jing University of Posts and Telecommunications,
[16] J. Amarante and J. P. Barros, ‘‘Exploring USB connection vulnerabilities Beijing, China, in 2017. She is currently pursu-
on Android devices breaches using the Android debug bridge,’’ in Proc. ing the M.S. degree with the Cyberspace Institute
14th Int. Joint Conf. E-Bus. Telecommun. (ICETE), 2017, pp. 572–577. of Advanced Technology, Guangzhou University,
[17] W. Meng, W. H. Lee, and S. R. Murali, ‘‘Charging me and I know your
Guangzhou, China. Her research interests include
secrets!: Towards juice filming attacks on smartphones,’’ in Proc. 1st
cyberspace security, mobile smart terminal secu-
ACM Workshop Cyber-Phys. Syst. Secur., 2015, pp. 89–98.
[18] L. Yang, L. Wang, and D. Zhang, ‘‘Malicious behavior analysis of rity, and intelligent attack-defense.
Android GUI based on ADB,’’ in Proc. IEEE Int. Conf. Comput. Sci.
Eng. (CSE) IEEE Int. Conf. Embedded Ubiquitous Comput. (EUC), vol. 2,
Jul. 2017, pp. 147–153.
[19] Nikolay Elenkov. Secure USB debugging in Android 4.2.2.
Accessed: Apr. 2019. [Online]. Available: https://nelenkov.blogspot.
com/2013/02/secure-usb-debugging-in-android-422.html
[20] Android Debug Bridge (ADB). Accessed: Apr. 2019. [Online]. Available: CHENGJIE JIN received the B.E. degree in com-
https://developer.android.com/studio/command-line/adb puter science and technology from Chang’an Uni-
[21] M. Xu, W. Sun, and M. Alam, ‘‘Security enhancement of secure USB versity, in 2018. He is currently pursuing the M.S.
debugging in Android system,’’ in Proc. 12th Annu. IEEE Consum. Com- degree with the Cyberspace Institute of Advanced
mun. Netw. Conf. (CCNC), Jan. 2015, pp. 134–139 Technology, Guangzhou University, Guangzhou,
[22] D. J. Tian, G. Hernandez, and J. I. Choi, ‘‘ATtention spanned: Com- China. His research interests include cyberspace
prehensive vulnerability analysis of AT commands within the Android
security, mobile smart terminal security, and intel-
ecosystem,’’ in Proc. 27th USENIX Secur. Symp., 2018, pp. 273–290.
[23] Accessibility Service. Accessed: Apr. 2019. [Online]. Available:
ligent attack-defense.
https://developer.android.com/reference/android/accessibilityservice/A
ccessibilityService.
[24] Auto.js. hyb1996. Accessed: May 2019. [Online]. Available:
https://github.com/hyb1996/Auto.js
[25] Scrcpy (v1.10). Genymobile. Accessed: Apr. 2019. [Online]. Available:
https://github.com/Genymobile/scrcpy
[26] Z. Tian, S. Su, W. Shi, X. Du, M. Guizani, and X. Yu, ‘‘A data-driven YANBIN SUN received the B.S., M.S., and Ph.D.
method for future Internet route decision modeling,’’ Future Gener. Com- degrees in computer science from the Harbin Insti-
put. Syst., vol. 95, pp. 212–220, Sep. 2019. tute of Technology (HIT), Harbin, China. From
[27] J. Qiu, L. Du, D. Zhang, S. Su, and Z. Tian, ‘‘Nei-TTE: Intelligent traf- 2016 to 2018, he was with Jinan University. He is
fic time estimation based on fine-grained time derivation of road seg-
currently an Associate Professor with Guangzhou
ments for smart city,’’ IEEE Trans. Ind. Informat., to be published, doi:
University, China. His research interests include
10.1109/TII.2019.2943906.
[28] Y. Xiao, X. Du, J. Zhang, and S. Guizani, ‘‘Internet protocol television network security, future networking, and scalable
(IPTV): The killer application for the next generation Internet,’’ IEEE routing.
Commun. Mag., vol. 45, no. 11, pp. 126–134, Nov. 2007.
[29] J. Tian, N. Scaife, D. Kumar, M. Bailey, A. Bates, and K. Butler,
‘‘SoK: ‘Plug & Pray’ Today—Understanding USB insecurity in versions
1 through C,’’ in Proc. IEEE Symp. Secur. Privacy (SP), May 2018,
pp. 1032–1047.
[30] K. Opasiak and W. Mazurczyk, ‘‘Secure Android debugging: Security-
analysis and lessons learned,’’ Comput. Secur., vol. 82, pp. 80–98, 2019, MAN ZHANG received the B.E. and M.S. degrees
doi: 10.1016/j.cose.2018.12.010. from Southwest Jiaotong University, Chengdu,
[31] Q. Tan, Y. Gao, J. Shi, X. Wang, B. Fang, and Z. Tian, ‘‘Toward a com-
China, in 2003 and 2006, respectively. From
prehensive insight into the eclipse attacks of Tor hidden services,’’ IEEE
2008 to 2018, she was with SafEngServices and
Internet Things J., vol. 6, no. 2, pp. 1584–1593, Apr. 2019.
Technologies Ltd., China. She is currently an Engi-
neer with the Peng Cheng Laboratory. Her cur-
rent research interests include data mining and
cyberspace security simulation. She is also a mem-
ber of the China Computer Federation.

HUI LU received the B.E. degree in electronic sci-


ence and technology and the M.S. degree in optical
engineering from Southwest Jiaotong University, ZHIHONG TIAN received the Ph.D. degree from
Chengdu, China, in 2003 and 2006, respectively, the Harbin Institute of Technology. From 2003 to
and the Ph.D. degree in electromagnetic field and 2016, he was with the Harbin Institute of Technol-
microwave technology from the Beijing University ogy. He is currently a Professor, a Ph.D. Supervi-
of Posts and Telecommunications, Beijing, China, sor, and the Dean of the Cyberspace Institute of
in 2010. He was a Research Associate with the Advanced Technology, Guangzhou University. His
Institute of Microelectronics, Chinese Academy current research interests include computer net-
of Sciences, China, from 2010 to 2017. In 2017, works and network security. He is also a member
he joined Guangzhou University, Guangzhou, China, where he is currently of the China Computer Federation and the Stand-
an Associate Professor with the Cyberspace Institute of Advanced Technol- ing Director of the Cyber Security Association of
ogy. His research interests include cyberspace security and intelligent attack- China.
defense.

178330 VOLUME 7, 2019

You might also like