How to Factory Reset Xiaomi Phone to Remove Persistent Malware
When malware resists app-level removal — reinstalling itself or hiding from scans — a factory reset is the nuclear option.
Before You Reset: Identify the Infection
Signs of persistent malware:
- Ads appearing on the home screen or in unrelated apps.
- Apps installing themselves without permission.
- Battery draining unusually fast.
- Security app detects threat but can't remove it.
Step 1 – Back Up Clean Data Only
Back up selectively — malware may be embedded in app data:
- ✅ Back up: Contacts (to Google), Photos (to Google Photos), important documents.
- ❌ Do NOT restore: App data from the infected period — it may reinfect.
- ❌ Do NOT back up: APK files from unknown sources.
Step 2 – Remove Mi Account and Google Account
Before resetting to avoid activation lock:
1. Settings → Mi Account → Sign out.
2. Settings → Accounts & sync → Google → [account] → Remove.
Step 3 – Factory Reset via Settings
- Settings → Additional Settings → Backup & Reset → Erase All Data (Factory Reset).
- On HyperOS: Settings → General Settings → Reset → Erase all data.
- Confirm with PIN/password and wait for reboot.
Step 4 – Deep Clean via Recovery Mode
If malware blocks Settings reset:
1. Power off completely.
2. Hold Power + Volume Up until the Xiaomi logo appears.
3. In Recovery menu: select Wipe data and cache → Confirm → reboot.
Step 5 – Re-Flash the ROM (Most Thorough)
If malware survives factory reset (rare — indicates system partition infection):
1. Download the official Global ROM for your model from xiaomifirmwareupdater.com.
2. Use MiFlash on Windows to flash via fastboot — this overwrites the entire system partition.
Requires unlocked bootloader. Eliminates even deeply embedded system-level malware.
Step 6 – Safe Re-Setup
After reset:
1. Install apps only from Google Play — no APKs from unknown sources.
2. Restore contacts from Google (clean source).
3. Re-enable Security app auto-scan and Google Play Protect.
Preventing Reinfection
- Never install APKs from unofficial sources — most Android malware enters this way.
- Enable Google Play Protect: Play Store → Profile → Play Protect → Scan.
- Don't grant Accessibility Service permissions to unknown apps.
Pro Tips
- Most factory resets on Xiaomi format the user data partition only — the system partition stays intact. This eliminates 99% of malware cases.
- If you suspect pre-installed malware on a counterfeit or gray-market device, re-flashing the official ROM is the only reliable fix. Use Dr.Fone – System Repair as an alternative GUI-based ROM restore tool.
💡 Dr.Fone Tip: Before resetting, use Dr.Fone – Phone Backup to safely back up your clean data (contacts, photos, messages) so you can restore only safe content after the reset.