雨上がり©コーラ
914 字
5 分钟
小米路由器3a刷入openWRT
INTRO
目前2025/08/22,这款路由器价格在十元到三十元之间,淘来刷软路由非常合适。
PREPARATION
需要下载的固件 :123684
需要的工具:termius,winSCP
刷入官改固件
- 打开MIWIFI后台,在系统维护页面手动上传升级固件
miwifi_r3a_all_da132_2.18.40.bin
- 等待升级完成。
确认 Windows 版本
- Windows 10 至少2004,内部版本至少19041。
- Windows 11
开启与 WSL 相关的 Windows Features
开启 Windows Subsystem Linux 和 Virtual Machine Platform 并重启 Windows。
- 以管理员运行 PowerShell。
- 输入
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
您会得到如下输出
部署映像服务和管理工具版本: 10.0.26100.1150
映像版本: 10.0.26100.4652
启用一个或多个功能[==========================100.0%==========================]操作成功完成。
接下来
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart
Path :Online : TrueRestartNeeded : False
您需要重启Windows。
安装WSL
输入
wsl --install
接下来就像正常Ubuntu设定一样,设置账户和密码,密码不显示是正常的。
正在下载: Ubuntu正在安装: Ubuntu已成功安装分发。可以通过 “wsl.exe -d Ubuntu” 启动它正在启动 Ubuntu...Provisioning the new WSL instance UbuntuThis might take a while...Create a default Unix user account: xiNew password:Retype new password:passwd: password updated successfullyTo run a command as administrator (user "root"), use "sudo <command>".See "man sudo_root" for details.
xi@SKYCHOW:/mnt/c/Users/33960$
Ubuntu环境即部署成功
部署解锁工具
- 在资源管理器中输入
\\wsl.localhost\Ubuntu
进入Ubuntu文件管理,打开home/<这里的文件夹名称为您的用户名>/ - 将
OpenWRTInvasion-0.0.10.tar.gz
和setup_openwrt_invasion.sh
移动到该目录。 - 使用
cd /home/xi
命令,切换到该目录(自行更改xi为您的用户名) - 赋予执行权限
sudo chmod +x setup_openwrt_invasion.sh
- 输入以下命令
cd OpenWRTInvasion-0.0.10
- 更改库地址
nano script.sh
由于原镜像失效,我们需要编辑download部分为如下内容
download_file_from_github() { # Rationale for using --insecure: https://github.com/acecilia/OpenWRTInvasion/issues/31#issuecomment-690755250 curl -L "https://gitee.com/juserzhang/OpenWRTInvasion/tree/master/script_tools$1" --insecure --output "$2"}
然后ctrl x
退出
- 运行
python3 remote_command_execution_vulnerability.py
出现如下输出
Router IP address [press enter for using the default 'miwifi.com']: 192.168.31.1Enter router admin password: 12345678
输入您的IP和后台密码即可 接下来会出现
There two options to provide the files needed for invasion: 1. Use a local TCP file server runing on random port to provide files in local directory `script_tools`. 2. Download needed files from remote github repository. (choose this option only if github is accessable inside router device.)Which option do you prefer? (default: 1)
我们输入2,回车即可运行
****************router_ip_address: 192.168.31.1stok: a80675f22f75d3281445ea2c2638f97efile provider: remote github repository****************start uploading config file...start exec command...done! Now you can connect to the router using several options: (user: root, password: root)* telnet 192.168.31.1* ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc -o UserKnownHostsFile=/dev/null [email protected]* ftp: using a program like cyberduck
出现如上输出,那么恭喜您,这部分步骤成功。
刷入breed
- 打开termius,通过telnet连接您的路由器,用户和密码均为root
- 查看并备份分区
cat /proc/mtd
备份分区,留意factory跟BootLoader对应的mtd分区,需要备份的是factory和BootLoader
dd if=/dev/mtd4 of=/tmp/eeprom.bindd if=/dev/mtd1 of=/tmp/Bootloader.bin
- 打开WinSCP,协议选择FTP,主机名为路由器IP,密码和用户名为root。
- 找到tmp目录,将
Bootloader.bin
和eeprom.bin
复制到PC上。并把breed复制进tmp - 回到终端,cd进tmp目录,开始刷入breed
mtd write breed.bin Bootloader
刷入openwrt
- 确保电脑连接了路由器LAN,拔掉路由器电源。按住复位键,再插入电源,等待指示灯闪烁后,松手。
- 输入
192.168.1.1
进入breed后台,这里先查看mac,若mac地址不正常,刷入先前备份的eeprom。 - 固件选择openwrt,刷入。这里我们使用的是bilibili@小渔学长编译的openwrt固件。
成功
等待片刻,输入10.32.0.1,密码admin,进入openwrt后台,成功。
特别鸣谢
@没了钱咋办 @Lonny_Lee @正在摸鱼的Liaronce @acecilia @hackpascal @小渔学长
这里是 Chongxi,期待与您的下一次见面。
Thanks for watching.
—Chongxi 2025-08-22
小米路由器3a刷入openWRT
https://blog.chongxi.us/posts/2025-08/21/2025-08-21-a/