☕ Buy a Coffee
Home / IT Support & Repair

How to Install OpenWrt on Xiaomi Mi Router 4A Gigabit & AX3000

A practical guide to bypassing Xiaomi firmware restrictions using the OpenWRT-InVasion exploit tool, unlocking telnet/SSH, and writing OpenWrt MTD partitions.

Sachin Siju
Sachin Siju
Lead Systems Engineer & Tech Blogger
Aug 18, 2026 8 min read
How to Install OpenWrt on Xiaomi Mi Router 4A Gigabit & AX3000

The Xiaomi Firmware Lockout

Xiaomi routers feature powerful MediaTek and Qualcomm hardware at rock-bottom prices, but their stock MiWiFi firmware locks out advanced networking options. Using the automated OpenWRT-InVasion Python script, we exploit a command injection in the stock web interface to obtain root shell access.

Step 1: Running the OpenWRT-InVasion Exploit

git clone https://github.com/0-kaladin/OpenWRT-InVasion.git
cd OpenWRT-InVasion
pip install -r requirements.txt
python remote_command_execution_vulnerability.py

Enter the router's stock IP (192.168.31.1) and your web admin token (from the browser address bar).

Step 2: Flashing OpenWrt via Telnet / FTP

Connect via Telnet to 192.168.31.1:21, upload your OpenWrt image to /tmp, and flash directly to OS partition:

cd /tmp
mtd -e OS1 -r write openwrt-ramips-mt7621-xiaomi_mi-router-4a-gigabit-squashfs-sysupgrade.bin OS1
Featured Infrastructure Partner

Deploy on High-Performance Hostinger Cloud

Get up to 75% OFF + free domain & SSL. Powering xube.me's sub-second response times.

Claim Discount ↗

Discussion & Insights

Related Technical Essays