How to hack Xiaomi: from unlocking the bootloader to Root rights

Xiaomi and Redmi smartphone owners often face the limitations of MIUI, which blocks third-party app installation, system interface advertising, and deep customization. The term β€œhacking” in this context means not hacking for criminal purposes, but gaining advanced access to device management, which opens the door to full customization of the interface, removing system debris, and installing modified versions of Android.

The process of gaining full control of the device requires technical literacy and an understanding of the risks. Unlocking the bootloader is the first and necessary step, without which further manipulation is impossible. Violating the integrity of the software shell can lead to a loss of warranty, but for enthusiasts it is the only way to unlock the real potential of the hardware.

In this article, we will look at legal methods for obtaining superuser rights, working with the debugging console and installing custom recavators. Officially unlocking through the Mi Unlock Tool is the only safe way not to turn the phone into a β€œbrick” at the start stage. Prepare for the process to take time, as the company’s security policy imposes a wait of 168 hours (7 days) after filing.

Preparation of the device and account Mi

Before you start any actions with system files, you need to configure the smartphone correctly. First of all, you need to activate the developer mode. β†’ About the phone and quickly press 7 times on the item "Version" MIUI". After the inscription β€œYou became a developer” you can go to advanced settings.

In the advanced settings menu, find the "Developers" section. It's critical to enable the "OEM Unlocking" option. Without activating this switch, the unlock attempt through the computer will be blocked at the bootloader level.

  • πŸ“± Put it in. SIM-Mobile Internet card (Wi-Fi is not enough for binding).
  • πŸ”’ Sign in to your Mi Account in system settings, not just in the GetApps store.
  • 🌐 Enable geolocation as security services require location confirmation.

⚠️ Note: Account binding to the unlock device is valid only for 7 days.If you reset or do not unlock the bootloader during this period, the procedure will have to start again.

Remember to make a full backup. The process of unlocking the bootloader automatically performs a full reset (Wipe Data), removing all photos, contacts and applications. Use Mi Cloud storage or local copying on your PC.

πŸ“Š What is your purpose of unlocking?
Removal of advertisements
Installation of custom firmware
Getting Root Rights
Just curious.
I don't know.

Unlock the bootloader through Mi Unlock

The official tool for removing locks is the Mi Unlock Tool. It works only on the Windows operating system and requires the installation of ADB drivers. Download the utility should only be from the official website miui.com/unlock to avoid malicious modifications.

After installing the program and logging in to your account, turn your smartphone into Fastboot mode. To do this, turn off the device and press the volume and power down buttons at the same time. Connect the phone to your computer with a high-quality cable and press the Unlock button in the program.

β˜‘οΈ Checking before unlocking

Done: 0 / 5

If the countdown timer shows 168 hours, you just have to wait. Attempts to get around this restriction through third-party paid services often lead to locking the device over IMEI on Xiaomi servers. Bootloader is a security guard, and there is no rush here.

After the waiting period, repeat the procedure. The utility will issue a warning about the risks to be accepted. The unlock process takes a few minutes, after which the phone will restart to the clean system.

What if Mi Unlock can’t see the phone?
If the program gives a connection error, try the following algorithm: 1. Install drivers manually through Windows Device Manager (the Android Phone section -> Update Driver). 2. Use another one. USB-port, preferably USB 2.0.3. Replace the cable with an original or certified MFi.4. Reboot your computer and phone again.

Installation of custom TWRP Recovery

The standard Recovery Recovery menu has limited functionality and does not allow you to install modified firmware or make full partition backups. TWRP (Team Win Recovery Project) is the gold standard custom recovery, providing full access to the file system.

To install, you will need a.img image file specific to your device model. Using a file from another model, such as the Redmi Note 9 for the Redmi Note 10, is guaranteed to cause a touchscreen failure or a complete system failure.

fastboot flash recovery twrp-3.x.x-x-miatoll.img


fastboot boot twrp-3.x.x-x-miatoll.img

The first command records the image in memory, and the second command compulsorily triggers it, and it is important to prevent automatic reboot to the standard system immediately after installation, since the official MIUI firmware can overwrite the custom Recovery with its bootloader.

Model of the deviceCode nameType of memoryYear out
Xiaomi Mi 9TdavinciUFS 2.12019
Redmi Note 10 ProsweetUFS 2.22021
Xiaomi 13fuxiUFS 4.02023
Poco F5marbleUFS 2.22023

After successful installation TWRP You get the ability to make full system images (Nandroid Backup), clear partitions. Dalton/Cache set up ZIP-It's a foundation for further experiments.

πŸ’‘

When you first start TWRP, swipe the slider to allow modifications. If the system asks for a password, enter the pattern lock or PIN code that was used to lock the screen in MIUI.

Getting Root Rights through Magisk

The most modern and secure way to obtain superuser rights is to use the Magisk manager. Unlike the old methods (SuperSU), Magisk works systemlessly, which allows you to bypass security checks in banking applications and games.

The process starts with downloading the stock firmware (Fastboot ROM), the corresponding version installed on the phone, and the boot.img file is removed from the firmware archive. This file is patched through the Magisk application installed on the smartphone.

  • πŸ“₯ Open Magisk and press "Install" β†’"Select and patch the file".
  • πŸ“‚ Show the way to the extracted boot.img.
  • πŸ’Ύ Copy the resulting file magisk_patched.img computer.

Next, the phone is transferred to Fastboot mode, and the patched image is recorded in the bootloader section by the fastboot flash boot command. magisk_patched.img. After the restart, the Magisk application with activated root rights will appear in the system.

⚠️ Note: After obtaining Root rights, some features such as Google Pay (in the basic configuration) and secure Netflix content stop working. HD. To restore functionality, you will need to configure MagiskHide or Zygisk.

Having root access gives you full control over files in the /system and /data directory, you can remove undeleteable system applications, change fonts at the system level, and use powerful utilities like Titanium Backup or Root Explorer.

Hidden opportunities and debugging by ADB

Even without unlocking the bootloader, users can use the Android Debug Bridge (ADB) protocol to remove ads and system debris. This does not require root rights, but includes a USB debugging mode.

To get started, install the Platform Tools package on your computer. Connect your phone and type in the adb device command to check the connection. The smartphone screen will have a debugging permission request that you need to confirm.

adb shell pm uninstall -k --user 0 com.miui.misystem


adb shell pm uninstall -k --user 0 com.miui.analytics

The above commands remove the system analyzer and MIUI advertising services. The list of packages that can be safely removed is extensive and depends on the specific model.

πŸ’‘

Using ADB allows you to β€œcut” advertising from the system without unlocking the bootloader, while maintaining the manufacturer’s guarantee, since the software shell formally remains unchanged.

ADB can also force you to change screen resolution, interface scale (DPI), and disable animations to speed up your old device, a powerful tool for fine-tuning Android to your needs.

Risk, security and recovery

Interfering with the operating system always carries risks, the main one being the ability to get a brick (a device that doesn't turn on), most often when you interrupt the firmware process or use corrupted image files.

The device is restored using EDL (Emergency Download Mode) mode, usually by a combination of buttons or by a test point, which allows the phone to take firmware directly bypassing the bootloader, but often requires an authorized Mi Account with engineer rights.

  • πŸ”‹ Do not interrupt the power of the device while recording partitions.
  • πŸ”Œ Use the original. USB-cable USB 2.0.
  • πŸ’» Make sure that Qualcomm or MediaTek drivers are installed correctly.

Banking applications can fail on unlocked devices, and Magisk will enable Zygisk and hide the Magisk app itself to solve this problem, and it may also require the Play Integrity Fix module.

Will the warranty be reset after unlocking the bootloader?
Formally, unlocking the bootloader does not deprive you of guarantees for hardware defects (screen, battery, communication modules). However, if the failure is caused by software intervention (overheating due to overclocking, memory burning due to firmware), the service center has the right to refuse free repairs. Before contacting the service, it is recommended to return the stock firmware and lock the bootloader back.
Can I upgrade to the air after Magisk installation?
Automatic OTA (Over-The-Air) updates on devices with a modified bootloader or Magisk installed usually don’t work or may cause an installation error. It’s recommended to download full firmware versions manually and install them via TWRP or update mode, saving a backup of the data beforehand.
Is it safe to use banking applications with Root rights?
Using banking applications on a rooted device is potentially less secure, as malware that gains access to root can intercept data. However, current root-hiding techniques (Magisk Hide, Shamiko) effectively fool security checks into making application use possible, even though the risk is theoretically higher than on a closed system.