MIUI 12.5 Android 11 SafetyNet Guide
Last updated on 16 September 2021: Updated files safetynet-fix-v2.1.1-riru from safetynet-fix-v2.1-riru
Tested on MIUI 12.5.1.4 Redmi Note 9 Pro Max (excalibur)
Following guide is for a clean installed MIUI 12.5 Android 11 rom on miatoll with unlocked bootloader :-
1: Always take backup of stock boot and dtbo at this stage for possible future use.
2: After initial setup of newly installed rom on stock kernel, you should install a custom kernel for MIUI R and reboot. (custom kernels have a hack for showing bootloader as locked in /proc/cmdline)
3: Reboot to recovery and install Magisk v23+ and reboot to rom.
4: Hide Magisk with some random app name and enable Magisk Hide.
5: Magisk hide google play store, google play services, google service framework and all banking apps + all apps involving payments like google pay, paytm, paypal, etc.
6: Clear app data of google play services & google play store.
6: Install magisk modules - Riru-v26.1.2.r505 and Safetynet_fix-miui and reboot normally back to rom.
7: Install magisk module - safetynet-fix-v2.1.1-riru
8: Copy file "bootudsbypass.sh" to /data/adb/service.d (this file is taken from: GitHub - Ingan121/UDSBypass: Magisk UDS Detection Bypass Script).
(This enables more possibility of banking apps not detecting root/unlocked phone. This fixed my Axis Bank app failing to run.)
9: Reboot normally back to rom.
10: After boot check magisk safetynet and try running the problematic banking apps. DONE.
Download Required Files:
Riru-v26.1.2.r505 (magisk module)
safetynet-fix-v2.1.1-riru (magisk module - needs riru installed)
Safetynet fix for MIUI (Petnoires SafetySpoofer magisk module)
Script for banking apps "bootudsbypass.sh" (Magisk UDS Detection Bypass Script)
All credits to respective authors. I only found my way to get all problematic apps working with safetynet passed.
Note:
1: You should enable Autostart for magisk app & set "no restrictions" instead of "battery saver" option & lock the app to be always be in memory.
2: You can use riru-LSposed module for other purposes, its not related to this.