Using the DMZ-setting of Huawei B593
Thursday, August 29. 2013
My previous post about my Huawei B593 4G-router has become quite popular, so I thought to tell more about my setup.
What I'd really need is a network bridge, so that my Linux-box would be the one getting a dynamically changing public IP via DHCP. Understandably it simply cannot be done with a mobile router. In UMTS-network, the mobile terminal will negotiate a data connection and get the IP-address associated with the connection. There literally is no chance for my router to do that via B593. Using an USB-based mobile terminal such a feat could be achieved, for example my Huawei E160 gets an IP-address directly to the Linux. No 4G LTE, though. So, I'll be sticking with my B593 for a while. See an example of a transfer speed measurement @ Ookla Speedtest.net. Not, bad huh?
I also did investigate if the box would be based on Linux. Huawei has some GPL-components in the firmware, but they don't release BusyBox nor Dropbear source. It is possible, that they are using something of their own make or simply don't have a prompt or are not using Linux at all. The reason I'd like to see them is that both BusyBox and Dropbear SSHd are very typically used in Linux-based hardware.
Doing a port-scan from LAN-side to B593 reveals, that it has something there:
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp filtered ssh
23/tcp filtered telnet
80/tcp open http
443/tcp open https
631/tcp filtered ipp
MAC Address: F8:3D:FF:F8:3D:FF (Huawei Technologies Co.)
... but since all the nice stuff (SSH and telnet) are filtered, I don't know if there are actually any services listening to those ports.
To repeat: to my understanding, a bridging firmware cannot be done. However, something very similar can be achieved, it has a DMZ-setting. See:
It says "You can configure a computer as the DMZ host that is exposed to the Internet so that unlimited services and exchanges are provided between the host and Internet, for example, online games and meetings." in the page. That is pretty much same as bridge.
I had to test if it really would work. I took a hping-utility for crafting raw IP-packets and ran:
hping -c 1 -n <-da-IP-address-here> -e "AAAA" -0 --ipproto 41
That sent a single (-c 1) raw IP-packet (-0) and stamped the outgoing packet a IPv6-encapsulation protocol (--ipproto 41). If the Huawei would have a simple UDP & TDP forwarding, such a packet would never pass trough.
On my Linux it said:
16:15:50.115851 IP sending.host.com > receiving.host.net: [|ip6]
16:15:50.115920 IP receiving.host.net > sending.host.com: ICMP host receiving.host.net unreachable - admin prohibited, length 32
Goddamn! It works! The packet properly passes trough.
My conclusion is that the DMZ-function is actually usable. Apparently there is no need for SSH-prompt -based configuration tweaking. It would always be nice, though. All Linux-nerds like me simply love to go to the prompt and type cat /proc/version and cat /proc/cpuinfo and boast about their hacking abilities to anybody who cares (not) to listen.
Will on :
Based on the posts you had, I can see that you have a great deal of knowledge about this modem. I have this modem but it seems it is branded as I don't see any page leading to the software update function. If it is possible to access the link and update the firmware, would it unlock other features like SMS, WPS, NAT, etc.? It's just another crap modem without all the advance features.
Would you happen to know the hard-coded links built into this modem? TIA
Jari Turkia on :
SiryaKatono Hunter on :
Thanks
Jari Turkia on :
No you cannot have that.
celo on :
I have the B593 as well. I do not have public ip address at my router side, so NAT is not the way how to achieve incoming connection to my local network.The LTE in Slovakia is in testing period right now, so i can not even pay for public IP. Could be the DMZ settings anyhow helpful (with ipv6 encapsulation) ? Could you describe your test with DMZ with more details if it is the case?
BTW, I have V100R001C00SP052 firmware, there is DDNS and VPN menu item (although it is greyed out ;o( ). Any other firmware with VPN enabled? Maybe it would be the last way how to reach my local server from internet.
Thanks for any hint.
Jari Turkia on :
celo on :
I have the B593 as well. I do not have public ip address at my router side, so NAT is not the way how to achieve incoming connection to my local network.The LTE in Slovakia is in testing period right now, so i can not even pay for public IP. Could be the DMZ settings anyhow helpful (with ipv6 encapsulation) ? Could you describe your test with DMZ with more details if it is the case?
BTW, I have V100R001C00SP052 firmware, there is DDNS and VPN menu item (although it is greyed out ;o( ). Any other firmware with VPN enabled? Maybe it would be the last way how to reach my local server from internet.
Thanks for any hint.
celo on :
i have found (at one Polish B593 forum) a way to mount and check root filesystem. Just enable FTP server on the router (USB management) , plug any USB stick and type "../.." as Directory under User Settings.
Use any FTP client to browse through root directory. You can find /proc/version (Linux version 2.6.21.5) and /proc/cpuinfo (system type:CHIP95358, cpu model :MIPS 74K V4.9). I hope this will help us to get as much as possible from the hidden functionalities.
celo on :
My only problem is, when i pack the firmware files to bin, the file size is much bigger ;o(.
Is there any other limitation for sshd, forex. blocked by firewall?
I hope we will find the way to connect to the router terminal console.
Any hints?
Thanks.
Jari Turkia on :
celo on :
any progress? Could I help U anyhow with that?
Jari Turkia on :
celo on :
I am not sure I undertood your findings. When extrancting (mine) V100R001C00SP052 firmware, there is the sshd in rootfs/bin directory.
Is there anything else we need than launching it during startup (by inetd)?
Jari Turkia on :
celo on :
http://blog.asiantuntijakaveri.fi/2013/08/gaining-root-shell-on-huawei-b593-4g.html
Do U think we need anything else yet?
But all the changes will be temporary (till next reboot) won't they?
Jari Turkia on :
celo on :
have u got acces to the router through ssh?
I've got 'subsystem request failed on channel 0' error message ;o(.
Jari Turkia on :
nos_com71 on :
don't know about other sub-models.
Jari Turkia on :
nos_com71 on :
things look different in each sub-model and even between each firmware ,this one worked with my b593-91 (so it is 91 not 12 or 22) ,also I re flashed it with another firmware which appeared to be a different admin/pass ,but couldn't SSH it.
mention my above admin/pass was again for b593-91 with original Huawei firmware (B593u-91_V100R001C00SP056)
hope this would help u.
Jari Turkia on :
nos_com71 on :
admin and user passes are in this track
/var/sshusers.cfg
it looks only original firmware is accepting to pass thru but not customized ones ,at least in my case.
Jari Turkia on :
nos_com71 on :
I flashed 4 different firmwares since,
none of them got me to ATP except this original Huawei B593u-91_V100R001C00SP056 firmware by above user/pass .
BTY ,I m not an expert in using commands, really I hoped my set in ur hands to enjoy it.
good luck
Jari Turkia on :
nos_com71 on :
since I'm an illiterate in commanding ,while I have a treasure to reach it .how can I change antenna setting to be external other than the default internal setting? (internal =0, external=1)
bty, if u need me to upload any results of shell-c, just give me the full commands u need.
thanks.
Jari Turkia on :
nos_com71 on :
I know it is not in Web-GUI for model 91.
I can reach it in /var/curcfg.xml , but when I change it ,it doesn't store this change.
so how to permanently change this setting?
thanks
Jari Turkia on :
bilbo on :
Jari Turkia on :
The GPL-parts are generally available for download as GNU Public License requires. However, all the good stuff is in the non-GPL parts. If you'd have source for that, I'd be interested.
BooBoss on :
Jari Turkia on :
You cannot send raw Ethernet-packets over TCP/IP (unless using a special protocol). A WOL-packet could be sent from a B593, if you can manage to get a suitable application into it.
Job on :
Because no bridge mode possible, right?
Jari Turkia on :
As bridging on u-12 isn't possible, you will have 2 routers (2 NATs) piggy-backing. Not the smartest setup, but it will do the job as a backup-route.
John McQue on :
Also, advice please on whether to set the b593 mobile connection as always on & with roaming enabled. The SIM is a UK EE.
ilmaisin on :
Could someone else with this device test if their unit allows incoming ipv6 connections?
Jari Turkia on :
If you're sure, that you are getting incoming IPv6-traffic and your B593 is blocking you, you'll need to SSH into it and check IP6tables rules. I'd say its more then likely, that they goofed something up (or did that on purpose).
ilmaisin on :
And according to DNA, incoming ipv6 connections are allowed except a few chosen ports.
https://www.dna.fi/tuki-liikkuvalaajakaista
Miika on :
Running Elisa's firmware V200R001B270D25SP00C260 on my b593s-22 that is dated Oct 17 2015 / 09:43:05. Saunalahti 4G and IPv6 enabled. And as far as i know IPv4 is behind nat so that wont work. IPv6 adresses are public and they should come through?
No luck getting incoming traffic through. Even with DMZ or port forwarding on.
Also tried ftp exploit script to change iptables. No good results there either. 1/10 times login passes but then there's other error messages:
pi@raspberrypi:~/git/b593exploit $ perl latest.pl 192.168.1.1 admin --ftp-setup user password
Argument "xfNz9v0BOoCW0agqwWWeXFmUcYmFR7whF8jTGrcZj5J7CAQ2fILPLchw..." isn't numeric in numeric gt (>) at latest.pl line 99.
Could not login! at latest.pl line 297.
pi@raspberrypi:~/git/b593exploit $ perl latest.pl 192.168.1.1 admin --ftp-setup user password
Argument "8gBq1cxPud5qLenL1OzPFxJ8CpDt4yHXBXyRx88lzbcTKdJ1JAQ9zA60..." isn't numeric in numeric gt (>) at latest.pl line 99.
Use of uninitialized value $usbstatus in string eq at latest.pl line 315.
Page didn't contain information about USB-sticks Continuing. at latest.pl line 315.
Use of uninitialized value $usbstatus in string eq at latest.pl line 316.
Use of uninitialized value $usbstatus in pattern match (m//) at latest.pl line 318.
Page contains garbled USB information Continuing. at latest.pl line 323.
Use of uninitialized value $usbDevice in concatenation (.) or string at latest.pl line 327.
Use of uninitialized value $usbDevice in concatenation (.) or string at latest.pl line 327.
pi@raspberrypi:~/git/b593exploit $
Is this because somebody at huawei disabled these vulnerabilities and my firmware is "too new"?
Llewellyn on :
I have bought the Huawei B315, I need to disable the default web port 80 of the router to put it on our secure network, is there anyway to do this?
Jari Turkia on :
Both can be achieved by SSHing into the device and adding a suitable IPtables-line to block any TCP/80 access.
Algerchen on :