Accidental backdoor by ISP [updated x2]

I’ve been a happy customer of my ISP BeThere for a few months now. Overall they’re great, they are quick to sort you out with your connection, their emails and other communications are very humerous and actually make good reading (I remember the routers documentation CD has a warning label reading something like “warning: geeky content inside”). When I signed up I managed to get the username root, this pleased me no end and I thought I’d finally found an ISP I want to stay with forever.

Finding the hole
Recently though a friend of mine was extremely bored and decided to nmap my IP address. He found, and told me, that I seemed to be listening on port 23, telnet. I was extremely puzzled by this, I haven’t port forwarded port 23, I would never use a telnet daemon for anything. It occured to me that it must be the router itself running the daemon. I telnetted to 192.168.1.254 and lo and behold it asked me to log in. I log in with default credentials (yes, I had never gotten around to changing those), which are Administrator:null

I get welcomed by some neat looking ASCII art and command line access to my router. I didn’t even know my router had telnet access but I quickly log out and set a password via the web interface. Now I should be secure. Wondering if others could telnet to my router from a remote location I ssh to a remote machine I have access to then telnet back to my router from there and try logging in. I’m reassuringly told that this account can not log in through the WAN interface (so thankfully I can only log in from within my LAN).
I log back in to the telnet daemon from my LAN to see what’s there, I find this:

{Administrator}[user]=>list
User Flags Role
—- —– —-
Administrator U Administrator
tech R TechnicalSupport
BeTech TechnicalSupport
bebox root

Keep in mind that according to the web interface only the Administrator account even exists. What the hell are all these other accounts? Thinking back to the error I got when trying to log in from a remote location I wonder if any of these accounts are capable of logging in from remote locations. I try logging in as BeTech from the remote connection (guessing it to have a blank password), it gives me an incorrect password error. How can I find the password to these 3 anomalous accounts?

Time to look through the configuration. Like most routers it’s possible to back up the settings file, in the case of this router you ftp to the router, browse to /dl/ and download user.ini. This file has all the settings in it. I copy that file to my home directory and search for the word BeTech of it. Here’s the output:

[ mlpuser.ini ]
add name=Administrator password=_CYP_removed role=Administrator hash2=removed defuser=enabled
add name=tech password=_CYP_removed role=TechnicalSupport hash2=removed defremadmin=enabled
add name=BeTech password=_CYP_removed role=TechnicalSupport hash2=removed
add name=bebox password=_CYP_removed role=root hash2=removed

A short time later I had the password of the BeTech account to be [removed] (for some reason I didn’t bother looking at the other accounts). I don’t know what the hash2 value stands for, wasn’t interested. I try logging in with BeTech:[removed] from my remote connection and lo and behold it works. I figuratively crap myself. First things first; I look for ways to change this. Sure I could change the password but there’s got to be a way to stop the telnet daemon from listening on the WAN. Sure enough, I find the line
ifadd name=TELNET group=wan
I simply remove the line. Slightly below I see
ifadd name=FTP group=wan
I remove that too. I upload the user.ini file replacing the existing one and reboot the router. I’m safe.

Exploiting others

Time to see if I can log in to others’ routers using this. I run nmap -p T:23 x.y.z.0/24. This gives me a list of people who are probably running the same router. I FTP to those IPs and grab /dl/user.ini.
Most of these people have changed their Administrator password, but my money says none of them knew about the other accounts. Now I have full access to FTP in to their routers even if they have changed their passwords, I have full read and write access to things from DNS details to DMZ settings, from Wifi passwords to VPN keys. I can then upload the new file back to their router, log into it’s telnet daemon and load the new settings file.

From the account name I’m going to guess that it was made as a technical support account by my ISP so if I call them up saying I have connectivity problems and all the normal stuff is ruled out they can connect straight to my router themselves and peek around. In a way it makes sense for them not to use SSH as that of course requries more stuff, and it may just be that stuff which is broken. There are better ways to do this though, one would be to have an ID printed on the router which I would give to their tech support which they use to calculate the BeTech account’s password. Alternatively let us easily turn off this setting and if we need tech support and we can’t enable it we’d just hit the reset to factory settings button.

Pretty much all the customers of my ISP are now vulnerable to this. The only ones who aren’t are people who’ve fixed this, people who have port forwarded port 23 and 21 (as port forwarded ports take priority over daemons) and of course people who don’t use the router the ISP supplies.

Kuza55 of sla.ckers.org scanned a much larger number of users; nmap -oG bewhole.txt -vv -sS -p23 -P0 x.y.0.0/16
He got 14716 potentially vulnerable routers but he couldn’t reliably check which were actually vulnerable and so dropped his research. Feel free to try to finish what he started.
Securing yourself

Incase you are running the router BeThere supplied, here’s how to fix it. FTP to 192.168.1.254/dl/ and download user.ini. That is the default IP, I assume you know how to find the IP if that’s not what it is. If user.ini isn’t there, telnet to the router (same IP). Type:

config
save
It’ll ask for the username, type user.ini and hit return
FTP to the router as I said earlier and grab the file.

Back up your user.ini file just incase, then open it. Find the heading [ servmgr.ini ] which is around line 771 (though it won’t be exactly there for you). Scroll down another few lines and you’ll find four lines:

ifadd name=FTP group=lan
ifadd name=FTP group=wan
ifadd name=TELNET group=lan
ifadd name=TELNET group=wan

Remove the two ending in wan. Connect again with your FTP client and upload this new user.ini file replacing the old one. Either reboot your router through it’s web interface or log back into the telnet daemon and type:
config
load
The telnet connection will die, that’s fine, in 30 seconds or so you’ll be online again with a safe router. Check with nmap-online that you’re still not listening on FTP or Telnet.

UPDATE: After talking to my ISP I have removed the IPs and the passwords from this post and all comments to this post. I have yet to conclude the talks with them but I hope to update this post back to its original form after a short while (a week or two).

UPDATE: virus has posted a perl script to automatically patch your box (even remotely). Though it is unconfirmed.

Print Friendly, PDF & Email

Comments are closed.