/4te.me
Быстроman как получить root-права на Android смартфоне. Я буду использовать OnePlus 3 и Android 8.0, но инструкция должна подойти и к другим устройствам.
Предисловие
Все действия вы выполняете на свой страх и риск. При неправильной последовательности, можно потерять данные или превратить телефон в кирпич. Также, важно понимать, что рутованный девайс, кроме некоторых удобств, несет в себе риски безопасности. Будьте внимательны.
Подготовка
Для начала, надо на компьютер установить adb и fastboot. Это утилитки из Android SDK для работы с подключенным по USB телефоном.
Для Windows есть удобный установщик adb, fastboot — https://forum.xda-developers.com/showthread.php?t=2317790
Вот здесь официальные дистрибутивы под все платформы — https://developer.android.com/studio/#downloads
Далее качаем TWRP. Это что-то типа livecd для телефона. Образ некой системы, в которой загрузится телефон, и в ней мы установим приложение Magisk.
TWRP (я брал версию 3.1.0-0-twrp.img) — https://dl.twrp.me/twrp/
Если у вас OnePlus, вот TWRP для них — https://eu.dl.twrp.me/oneplus3/ (надо брать этот twrp если вылетает ошибка dtb not fount)
Magisk — это open source приложение, которое дает рут права на телефон, и позволяет скрывать наличие рута от других приложений, чтобы работал Android Pay. Также, обновления системы, которые прилетают “по воздуху”, не должны сломаться. Лучше использовать Magisk, а не SuperSU.
Теперь включим режим разработчика на телефоне. Для этого в настройках, в разделе “О телефоне”, надо несколько раз нажать на “Номер сборки”. После раза 10-го, появится сообщение “Теперь вы разработчик”, и в настройках появится новый пункт “Для разработчиков”.
Разблокировка загрузчика
Разблокировка загрузчика удаляет все данные с телефона и sd-карты
Также, разблокировка загрузчика, без установленного далее Magisk, может сломать Android Pay.
В настройках “Для разработчиков” включаем “Отладка по USB”, “Заводская разблокировка” и “Варианты перезагрузки”
Загружаемся в fastboot mode. Для этого зажимаем кнопку выключения, выбираем “Перезагрузка” и далее “Загрузчик” Второй способ — выключить телефон, зажать клавишу громкости вверх и клавишу включения. Через несколько секунд появится fastboot mode
Подключаем телефон по USB-кабелю. И проверяем что устройство доступно в системе. Для этого выполняем:
ПОСЛЕ ЭТОЙ КОМАНДЫ ТЕЛЕФОН ПЕРЕЗАГРУЗИТСЯ И ВСЕ ДАННЫЕ БУДУТ УДАЛЕНЫ. Делайте бэкапы всех данных до этого шага.
Теперь загрузчик разблокирован.
Получение root
- Подключаем телефон к компьютеру в режиме передачи файлов MTP
- Заливаем на телефон zip-файл Magisk, скачанный выше из github
- Загружаемся в TWRP. Для этого перезагружаем телефон в fastboot mode (см. пункт 2 инструкции выше как разблокировать загрузчик) и на компьютере выполняем:
Все, теперь с помощью Magisk Manager можно выдавать root-овые права приложениям, которые их запрашивают, а также скрывать от других приложений, что этот девайс рутованный, чтобы не сломать Android pay.
Источник
[Закреплено] Получение Root-прав с помощью ПК
В данной теме предоставлены методы получения Root-прав на мобильный телефон с помощью ПК.
Навигация по теме
Автор темы, сайт или пользователи данной темы, не несут ответственности за возможный причиненный ущерб в результате модификации Вами устройств.
Всё что вы делаете, делаете на свой страх и риск!
Самые свежие Вакансии на нашем сайте | Благодарны за помощь? Поддержать проект
Получение Root-прав на Android 1.5 — 6.x.
Самые свежие Вакансии на нашем сайте | Благодарны за помощь? Поддержать проект
Получение Root-прав через ADB (android debug bridge)
- SuperOneClick OS 2.3 — 4.0
- Click2RootOS 2.3
- Terminal-ROOT by MoNTE48OS 2.3+ (Получение Root через adb.)
- ROOT v5.0 Root для ICS без бута, для всех смартфонов с OS 4.0
Для работы программ указанных выше необходим ADB!
Самые свежие Вакансии на нашем сайте | Благодарны за помощь? Поддержать проект
Получение ROOT прав на прошивке 4.4.4. программой newroot.exe для разблокированного (заблокированного) загрузчика.
Первоначально программа написана для Z1, но работает и на Z Ultra.
Необходимые условия:
- ADB драйвера для нашего устройства;
- Настройки -> Функции для разработчиков -> Отладка по USB (должна стоять галочка);
- Отключите антивирус на ББ;
Получение ROOT
- Скачать и распаковать программу (см. ниже);
- Подключите смартфон к ББ;
- Нажмите «Check this to root your phone»;
- Согласится со всеми условиями на экране смартфона;
- Дождаться перезагрузки смартфона. После перезагрузки у Вас появится приложение «Суперпользователь». Вам остается только установить SuperSU из Маркета и удалить «Суперпользователь»;
- Наслаждайтесь!
Самые свежие Вакансии на нашем сайте | Благодарны за помощь? Поддержать проект
SRSRoot (получение рут для Android OS 1.5-4.2)
Очередная малоизвестная утилита для получения ROOT.
Файл загружен в архив, пароль: alstrive.ru
Прошивка модуля связи: FW8955m-V1.1.7.0
Версия ядра: 3.4.0+
Номер сборки: V4.1.1.0-SANEI-V01
Самые свежие Вакансии на нашем сайте | Благодарны за помощь? Поддержать проект
ROOT v5.0
Root для ICS без бута, для всех смартфонов с андроид 4.0.X (самому проверить не на чем, так что надежда на вас, владельцы ICS).
Как получить ROOT-права
- Распаковываем архив на диск С в компьютере, подключаем смартфон.
- Запускаем bat файл
- Нажимаем Enter, тело перегружается
- Нажимаем еще раз Enter, и тело еще раз перезагружается
- Нажимаем в последний раз Enter, тело перезагружается уже с рутом.
Клавишу Enter нажимать только после полной загрузки девайса.
p.s. Отладка по юсб и режим накопителя, а также установленные драйвера на ББ для вашего смартфона обязательны!
Самые свежие Вакансии на нашем сайте | Благодарны за помощь? Поддержать проект
Root-права на Android 7 и Android 8
Для получения «прав суперпользователя» на новых версиях Андроид нужно поступать немного по-другому, а именно…
- Для начала (на некоторых моделях) следует разблокировать загрузчик ;
- В настройках смартфона, среди функций «режима разработчика» необходимо включить отладку по USB ;
- Затем прошить в устройство кастомное рекавери (обычно TWRP— необходимо скачать версию именно для вашего устройства).
Например, для моделей Samsung поможет — программа Odin; - И на последнем шаге — установить файл для Root-прав (в основном это SuperSU.zip) с помощью установленного рекавери TWRP;
- Перезагрузить смартфон или планшет — и теперь Вы администратор своего андроид-гаджета (рут установлен).
Самые свежие Вакансии на нашем сайте | Благодарны за помощь? Поддержать проект
Источник
Android Rooting Using ADB
You have an Android Device and you are familiar with Linux-based operating systems. Maybe, you like SSH or telnet to communicate with the device; you want to setup your device as a router to connect home PC to the Internet. However, you will be surprised. Android has neither login screen nor possibility to gain privileged user access to the system to do these things. This is one of the Android security principles to isolate applications from the user, each other, and the system.
In this article, I will describe you how to obtain root access on Android device in spite of security, so basically we will discuss some Android exploit development tips. I will delve deeply into one of the Android rooting principles — the adb exhaustion attack, one of the Andoid vulnerabilities, which is simpler to understand than a previous udev exploit. It is suitable for all Android-powered devices with the version 2.2 and lower.
Android rooting explained: principles
Overview
In three words, the main rooting idea is to get super user rights on a device shell. Like a standard Linux shell, it allows you to interact with the device by executing commands from the shell. The shell can be accessed via ADB (Android Debug Bridge) command tool. The main purposes of the ADB on Android-powered devices are debugging, helping to develop applications and also, in some cases, it is used for synchronization purposes (when syncing HTC Wildfire, it is required to turn on the USB Debugging). We will use the ADB tool for uploading and executing the exploit, working with rooted device via super user shell with full access to whole device file system, programs and services.
ADB includes three components:
- A client, which runs on your machine. Windows users can invoke it from the cmd and Linux users — from the shell;
- A server, which runs as a background process on your machine. It manages communication between the client and the daemon running on the Android-powered device;
- A daemon, which runs as a background process on the device.
We are interested only in the third component. The daemon runs on a device and communicates with a client through a server. When you issue the ADB command like a shell, the daemon will create a shell instance on a device and redirect its output to the client. Obviously, the shell new instance created by the daemon inherits rights and environment from its parent. As the daemon runs with the AID_SHELL rights, the shell new instance and all processes created by the shell will have the same access rights. Hence, to get super user rights in the shell, we just need the daemon to be running with these rights.
To understand why the ADB daemon has the ADT_SHELL user space, we will consider how it is started up and look at its initialization script.
The first user land process started after the Android device booting is the init process. After initialization and starting of internal services like property service, ueventd service etc., it begins parsing the init.rc configuration script. The ADB daemon is mentioned in the script as the service and it is started by the init service on the boot if the USB Debugging is enabled.
Let’s look at the ADB daemon initialization source code. The main daemon entry point, where it starts its execution, is adb_main. I skipped non significant pieces of code to focus your attention on the daemon security.
So, what we see here. When the ADB daemon is starting, it has super user rights, like the init process has. However, the daemon reads some properties from the system and decides to set secure flag or not. Usually, if the device is not a development device and it is not an emulator, the properties have such values:
After properties are checked, the secure flag is set to true, and we hit to such code section:
Starting from this point, the daemon continues its execution with the AID_SHELL user id as it drops root privileges. All processes, started by the ADB daemon, like sh , will inherit its rights and will work in very limited environment. It is really sad, isn’t it?
How to root Android programmatically: Exhaustion attack
The main Android device rooting principle of the exploit described in this article is the setuid exhaustion attack. The setuid function changes the user id for a process only in case if there are resources available, otherwise it fails and the process remains with that user id, with which it was started. Let’s look at the resources that can be limited by the Linux operating system. We are interested only in the RLIMIT_NPROC resource. This resource limits maximum numbers of processes that can be created with the same user id. If you have reached the limit, you can’t create more processes with this user id. The setuid function doesn’t create processes, but it follows this rule. Once, the NPROC limit for the AID_SHELL user is reached, setuid fails and the process continues its execution with the user id set before the setuid call. It means, when the ADB daemon starts with the AID_ROOT user id and tries to change it for AID_SHELL , for which NPROC is reached, setuid fails and the daemon user id remains AID_ROOT .
It is easy enough, isn’t it?
In files attached to the article, you can find the binary file and Android root exploit source code. They implement the adb exhaustion attack explained above. The rooting process is easy for a user and I will describe how to use it below, but now, I will go into detail about the attack implementation. I will touch upon the Android rooting code structure and go into detail about a few important points.
Let’s look at the root() function in the impl.cpp file. It implements the main logic of the exploit.
At the beginning, after it gets and prints the NPROC limits, it runs the ADB daemon PID and saves it into a variable. It will be used later to kill original process. Next, look at the fork loop:
The code above represents an infinite loop. It forks calling process and exits from a child. That is enough because PID , allocated for current user, remains active until the parent process exits. The loop works until the fork function returns negative value. It means that we have reached the NPROC limit. Let’s look at the next code piece. The PID is negative, but we have to remember that there is one more shell user process that will be terminated soon. This process is the ADB daemon that is still running. We couldn’t kill it on start because the init process would start it again and it is an advantage for us. So, as soon as we reach that condition, we read the ADB daemon PID and check if its user id is AID_SHELL or AID_ROOT (because we could reach the condition from the second or third iteration).If it is AID_SHELL , the program just sends SIGKILL to it and continues the loop (soon, we will reach it again). Once the daemon is killed, one more PID for this user is freed. We have to allocate this PID for the AID_SHELL user as soon as possible to prevent the daemon setting its user id as AID_SHELL . Ideally, there will be two additional loops: the first one forks and allocates a new PID for the AID_SHELL user and, as the result, the second one reaches the limit again, checks the daemon PID that should be AID_ROOT and exits. However, because of lack of resources or lots of delays, there could be rather more iterations.
To prevent the exploit infinite loop in case if it is impossible to start the ADB daemon as root, there is a respawn guard for each forked child. Ten iterations and one second timeout have been chosen empirically when I was working with several devices and I found that some devices had a too big NPROC limit. It is obvious. They enquire too much processor resources to handle all created child processes. So, you may change the guard to fit your requirements or device.
Configuration & Build
The exploit was configured to be built with the NDK toolset both on Linux, and on the Windows platform. If you are working on Linux, it will be enough for you to download NDK only; however, on the Windows platform, you have to download and install the Cygwin environment on your machine. In this paragraph, I will tell you how to configure and build the exploit on the Windows platform.
First of all, download and install the Android SDK. We need only a platform-tools package from the SDK to communicate with a device through ADB, so, at the SDK root directory, start the SDK Manager and check the platform-tools package. Install it.
You can add a path to platform-tools into your PATH variable or type the absolute path to the adb.exe executable any time later.
The second step is to download and install the Android NDK package and the Cygwin environment. Install them in the same location with SDK and add a path to your NDK package into the PATH variable or into your Cygwin .bash_profile . Then unpack a project archive attached to this article into your working directory available for Cygwin.
The project structure is very simple. In the AndroidExploit root, you will find two directories. In the bin directory, I have placed a precompiled exploit binary and a windows shell script file. The jni directory contains sources and the NDK build scripts.
To build the project, run the Cygwin environment, change a directory to the project/jni directory, and execute ndk-build. The Compiler output should look like this:
You can find an executable at libs/armeabi/exploit. The path is relative to the root of the project.
Running
The next paragraph describes how to use the binary file. You download the Android SDK, install platform-tools and make them available from the PATH variable. At first, enable the USB Debugging on your device. For this, from the main screen, go to Settings -> Applications -> Development and check the USB Debugging option, then connect your device to the PC and check that it has been detected by Windows Device Manager. Otherwise, install the Android USB drivers for your device from the manufacturer site.
Type the adb devices command in the command line. It will show you devices connected to your PC. If there are no devices connected, check that Windows Device Manager and Android USB drivers are installed.
We are on the right way! Let’s go to the device. Type the adb shell command, which will start the device shell, and then check your id to see who you are.
As it was expected, you are a shell user that has no privileges, no access, nothing … The only things you can do are installing programs and listing some directories. In other words, you can perform only permitted actions. I was very surprised when I couldn’t read /data/data directory, it was impossible for me to list it and see what programs were installed on my device.
Break the law. Go to the exploit bin directory and type adb push exploit /data/local/tmp . This command will upload the exploit in the device temporary directory available for the user. Then, type adb shell and change the directory to /data/local/tmp. The ls –l command will show you its content and permissions on recently uploaded files. Make the file executable by executing chmod exploit 776 and run it by ./exploit root.
The output shows NPROC and ADB daemon PID. Then, as soon as RLIMIT is reached, the shell will be disconnected. Wait for
5 seconds and type adb shell again. As a result, you should see root # shell. Type id to make sure you are a root.
Yes, you are! Now, you can do anything even… let me think … even damage your device! So, all things you will do next are at your risk. Be careful!
In this article we discussed how to root Androidusing ADB. One more time I want to notice that the exploit works only on Android devices with versions 2.2 and older.
Источник