Android rooting security considerations


Question

I know this question has been asked many times, but I didn't see a clear answer to it from security experts, or it is from several years ago and things might have changed.



My question is double:




  1. first of all, nowadays, how does the process of rooting an android phone work (please detail if there are various alternatives) ? Does it rely on a security hole, or is it a kind of attack (such as physical access to the device) that is not part of the security perimeter of android ? In the first case, why is it that it's not fixed, as there are open bounties for the android system ? Note that I'm just talking about the android system itself (such as a Nexus Phone), with the latest patches.


  2. Second related question: What would be the security risk of rooting an android phone ? If I am not mistaken, these could be grouped in at least two issues: the rooting process itself, and the aftermath.



    a. Regarding the rooting process, is there any open source procedure (or at least closely reviewed) to root a nexus phone that could guarantee that there's no malware installed in the process ? (see also first question)



    b. From what I understand, having a rooted android is no different than having a linux OS with a root account. Are there any (free, open source?) apps that can monitor (what commands have been launched, etc) and prevent apps from getting access to the root account without my agreement ? (so that it is linux OS where any account that requires root privileges must go through 'sudo' and ask the user to enter their password).



Answer


First of all, nowadays, how does the process of rooting an android
phone work?




By using an exploit in the Android system, a binary file which is named su is added to /system/xbin partition. When an application wants to execute a command with root privileges, it executes the command with an su at the beginning of it. This sends a call to the binary file. Binary file reads a text document generated by the GUI application. If in this text file there aren't any specific information about the app that asks for root access, then the binary checks another text file (again, generated by the GUI) that shows how it should act by default in such a case. Normally in such a case, GUI app will prompt you about an app asking for root access and will ask you if you want to grant it. Depending on your decision, the GUI app will tell the binary to whether or not should it grant that app root access.



Whole process is pretty much that. However, methods of rooting are so many, that I can't fill them all in here. Because they mostly vary across manufacturers.




What would be the security risk of rooting an android phone ? If I am not mistaken, these could be grouped in at least two issues: the rooting process itself, and the aftermath.




Well, we can do so if you want.



For the rooting process itself:



First of all, it voids your warranty. Other than that, even though it is hard to completely brick the phone when only trying to root it, it is still possible when one is not careful enough. But the most common case is usually bootloops, which is not that much of a big problem in the hands of someone who knows what they are doing.



For the aftermath



A rooted phone is pretty much the same, only with more customization for a person who knows what they are doing. But every now and then there are some guys who corrupt their IMEIs, delete the Telephone app or sometimes completely brick their phone by messing up stuff in /system. Also, giving root access to an app with bad intentions, might not (and probably will not) end well.




a. Regarding the rooting process, is there any open source procedure
(or at least closely reviewed) to root a nexus phone that could
guarantee that there's no malware installed in the process ?




Well, I don't know about Nexus a lot but I don't think a rooting process might actually end up with malwares in your phone. Most su binary creators share their codes at gitHub already. And the popular ones (i.e. Chainfire from XDA) are trustworthy developers that have the trust of the community.




b. From what I understand, having a rooted android is no different
than having a linux OS with a root account. Are there any (free, open
source?) apps that can monitor (what commands have been launched, etc)
and prevent apps from getting access to the root account without my
agreement ? (so that it is linux OS where any account that requires
root privileges must go through 'sudo' and ask the user to enter their
password).




Know this: Apps can make use of the exploits on their own and gain access even on a non-rooted phone. However, the GUI apps like SuperSU or Superuser come with their own su binary that act only as ordered by the GUI app. So if you don't let them, they don't have root access.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes