Home 类库下载 java类库 What level of attacks can Android enable by enabling USB debugging?

What level of attacks can Android enable by enabling USB debugging?

Nov 01, 2016 am 11:31 AM
android

0x01 Original Intention and Applicable Scenarios

Android’s USB debugging mode is designed for developers. Developers can use it to debug or test applications during the application development process.

adb provides a series of functions that are helpful for development, such as application installation and uninstallation, backup and recovery, log output and filtering, and it also provides a very user-friendly adb shell with considerable permissions.

In addition to developers, reverse analysts also use the adb interface when conducting reverse analysis and dynamic debugging of applications. For example, through this interface, they can dynamically debug and track so or smali, and dynamically debug some functional codes. Verify and so on.

However, convenience and security are inversely proportional to a certain extent. Under its rich functions, there are also a series of security issues.

0x02 Adb information leakage and permission leakage problem

If the debugging information output by logcat is not deleted when the application is released, it is very likely to cause sensitive information to be leaked. In minor cases, for example, logcat may print out the application The visited web page link or some other intermediate variables may also leak the account password. After all, the threshold for Android development is low, and the level of developers is inevitably uneven.

In order to facilitate debugging, developers may even write like this:

What level of attacks can Android enable by enabling USB debugging?

Android logcat information leaks have been disclosed many times in the past, such as:

WooYun: Tuniu.com app logcat information leaked users’ Group chat content

WooYun: Surfing browser logcat outputs user text messages

WooYun: Hangzhou Bank Android client login account and password information is leaked locally

In addition, many Android application vulnerability scanning platforms currently on the market will also focus on logcat The abuses are scanned and presented in the report, such as Tencent King Kong Audit System, Alibaba Security, 360 Risk Mirror (former Bug Hunter), etc. This also reflects the universality of this problem from the side.

In addition to the mistakes of developers, there are also some flaws in the design of adb itself. There was once a paper that specifically studied this issue: "Bittersweet ADB: Attacks and Defenses".

Through ADB or an Android application that has applied for ADB permissions, you can monitor private information such as text messages and phone records without applying for permissions, monitor/simulate screen click events, access private directories of other applications, and monitor Android devices Conduct DoS attacks, etc.

Most of the above behaviors can be obtained through the adb shell dumpsys command. For more details, please see the reference link [2].

0x03 Android backup problem

This is a very old problem. In low-version Android systems, when backing up an application, its private data will be backed up, and then you can Specific tools extract them, as shown below:

What level of attacks can Android enable by enabling USB debugging?

So what are the private data of applications? First of all, there will be personal identity credentials, or account passwords or other credentials. Generally, applications have private data I am quite confident. After all, it is called "private data", so many applications directly store it in plain text. Although some are encrypted, the data can be decrypted through reverse analysis of the application. For example, from a certain The content backed up in the client contains the following files:

What level of attacks can Android enable by enabling USB debugging?

You can find the decryption process by reverse engineering the apk, and you can decrypt it by copying the decryption class and method:

What level of attacks can Android enable by enabling USB debugging?

Another example is WeChat’s database , some articles have analyzed the encryption process of the WeChat database and given the method of generating the encryption key. If the WeChat local database, uin, and imei are obtained at the same time, the encryption key of the database can be calculated based on the latter two. And decrypt the encrypted database. At this time, all your chat records will be directly exposed to the sun.

In addition to directly manually decrypting the data, you can also restore the data intact to another mobile phone through adb restore, thereby forging identity, such as the article on droidsec "Steal the Weibo account of the goddess around you in two minutes" (refer to Link [4])

Some people have noticed that when using adb backup, you need to manually click to confirm before backing up. If the attacker does not have the opportunity to click on the screen, there will be no problem. However, Android has a mechanism called the input and output subsystem. In adb The sendevent command can be executed under the shell and can simulate various user inputs. Each model is different. On my machine, sending the following event can simulate the click and allow operation:

#EV_KEY       BTN_TOUCH            DOWN 
sendevent /dev/input/event7 1 330 1 
#EV_ABS       ABS_MT_POSITION_X    366 
sendevent /dev/input/event7 3 53 366 
#EV_ABS       ABS_MT_POSITION_Y    690 
sendevent /dev/input/event7 3 54 690 
#EV_SYN       SYN_REPORT           00000000 
sendevent /dev/input/event7 0 0 0 
#EV_KEY       BTN_TOUCH            UP 
sendevent /dev/input/event7 1 330 0 
#EV_SYN       SYN_REPORT           00000000 
sendevent /dev/input/event7 0 0 0
Copy after login

0x04 through adb stallion

Since it is through adb The application can be installed, and it is silent, so naturally it can be used for you without the user being aware of it.

However, ordinary horses may not have icons and interfaces to increase the chance of being discovered, and applications that have not been launched cannot run, which means that the BroadcastReceiver they registered cannot receive anything. It needs A process of awakening.

Fortunately, adb shell can also realize this wake-up process. The adb shell am command can start specific components of specific application packages, so that the pony can run successfully.

Of course, if the attacker has a more powerful method, such as directly adb pushing an exploit and elevating privileges to root, it will be simpler and more crude.

0x05 Malicious code injection

This method is relatively elegant. When connected to USB debugging, you can use a series of commands to inject a custom malicious code into the installed application on the phone. This code It can be as simple as playing a greeting, or it can be very complicated remote control.

In order to further increase the credibility, you can choose an application that has applied for high permissions for injection. For example, after injecting an address book management software, it requests to read your contact list, which seems to be fine.

Although academia and industry have many measures to prevent repackaging, in actual tests, the success rate of this attack method is really not low, and even if the injection into an application fails, the crudest method can still be used. pm list packages -3 List all packages and try it again.

The following I wrote a simple program to inject a metasploit meterpreter http reverse shell payload into an application on a mobile phone with USB debugging turned on. There is no need to perform any operations on the mobile phone during the whole process. The general workflow is as follows:

What level of attacks can Android enable by enabling USB debugging?

When you click the injected application again, you will receive a meterpreter shell on the handler opened on the listening server:

What level of attacks can Android enable by enabling USB debugging?

What level of attacks can Android enable by enabling USB debugging?

The above, you can remotely control the Android application on the server side , after getting the Android meterpreter shell, you can do many things, including privacy stealing, sending text messages, opening web pages, taking screenshots, and taking photos.

Even, you can call your front and rear cameras for real-time monitoring.

Some of the commands supported are as follows:

What level of attacks can Android enable by enabling USB debugging?

0x06 Finally

In Android versions after 4.4, if you want to connect to adbd on an Android device, you need to verify the fingerprint of the host machine, which to a large extent Reduces the possibility of being attacked through these methods. However, today's Android management software on PC strongly encourages you to turn on USB debugging, and will even teach you step by step how to turn it on, so a considerable number of people are still exposed to this risk.

As you can see from the above, there are still many things that can be done through adb. The above are just some of the commonly used methods. If you want to completely prevent being attacked by the above methods, the simplest and most effective way is to turn off USB debugging. , and try to download trusted applications from regular application markets.

After all, imagine if you are at a train station or a public place, using a public charging socket that someone put there, and there is a malicious computer behind it, and you happen to open it, or you are induced by it to open it. USB debugging...


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades Sep 12, 2024 pm 12:23 PM

In recent days, Ice Universe has been steadily revealing details about the Galaxy S25 Ultra, which is widely believed to be Samsung's next flagship smartphone. Among other things, the leaker claimed that Samsung only plans to bring one camera upgrade

Samsung Galaxy S25 Ultra leaks in first render images with rumoured design changes revealed Samsung Galaxy S25 Ultra leaks in first render images with rumoured design changes revealed Sep 11, 2024 am 06:37 AM

OnLeaks has now partnered with Android Headlines to provide a first look at the Galaxy S25 Ultra, a few days after a failed attempt to generate upwards of $4,000 from his X (formerly Twitter) followers. For context, the render images embedded below h

IFA 2024 | TCL\'s NXTPAPER 14 won\'t match the Galaxy Tab S10 Ultra in performance, but it nearly matches it in size IFA 2024 | TCL\'s NXTPAPER 14 won\'t match the Galaxy Tab S10 Ultra in performance, but it nearly matches it in size Sep 07, 2024 am 06:35 AM

Alongside announcing two new smartphones, TCL has also announced a new Android tablet called the NXTPAPER 14, and its massive screen size is one of its selling points. The NXTPAPER 14 features version 3.0 of TCL's signature brand of matte LCD panels

New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades Sep 12, 2024 pm 12:22 PM

In recent days, Ice Universe has been steadily revealing details about the Galaxy S25 Ultra, which is widely believed to be Samsung's next flagship smartphone. Among other things, the leaker claimed that Samsung only plans to bring one camera upgrade

Vivo Y300 Pro packs 6,500 mAh battery in a slim 7.69 mm body Vivo Y300 Pro packs 6,500 mAh battery in a slim 7.69 mm body Sep 07, 2024 am 06:39 AM

The Vivo Y300 Pro just got fully revealed, and it's one of the slimmest mid-range Android phones with a large battery. To be exact, the smartphone is only 7.69 mm thick but features a 6,500 mAh battery. This is the same capacity as the recently launc

Samsung Galaxy S24 FE billed to launch for less than expected in four colours and two memory options Samsung Galaxy S24 FE billed to launch for less than expected in four colours and two memory options Sep 12, 2024 pm 09:21 PM

Samsung has not offered any hints yet about when it will update its Fan Edition (FE) smartphone series. As it stands, the Galaxy S23 FE remains the company's most recent edition, having been presented at the start of October 2023. However, plenty of

Xiaomi Redmi Note 14 Pro Plus arrives as first Qualcomm Snapdragon 7s Gen 3 smartphone with Light Hunter 800 camera Xiaomi Redmi Note 14 Pro Plus arrives as first Qualcomm Snapdragon 7s Gen 3 smartphone with Light Hunter 800 camera Sep 27, 2024 am 06:23 AM

The Redmi Note 14 Pro Plus is now official as a direct successor to last year'sRedmi Note 13 Pro Plus(curr. $375 on Amazon). As expected, the Redmi Note 14 Pro Plus heads up the Redmi Note 14 series alongside theRedmi Note 14and Redmi Note 14 Pro. Li

Motorola Razr 50s shows itself as possible new budget foldable in early leak Motorola Razr 50s shows itself as possible new budget foldable in early leak Sep 07, 2024 am 09:35 AM

Motorola has released countless devices this year, although only two of them are foldables. For context, while most of the world has received the pair as the Razr 50 and Razr 50 Ultra, Motorola offers them in North America as the Razr 2024 and Razr 2

See all articles