Posted: Sun Mar 27, 2011 6:30 Post subject: My e3000 got pwned...by a crafty virus
I came home yesterday to find an interesting screen loaded on both my mac and windows computers. Since this strange page was loading regardless of what I would try to do I started to investigate the router.
I have an e3000 running MEGA - build 15962
Here's the process my router now goes through when it boots up. I didn't wipe the config yet so I could capture what was going on.
The final result is a microsoft looking page telling you that you need to download kb91021753.exe which I'm going to guess is a virus. I saved it to my mac but haven't loaded up a sacrificial PC yet to test what it does.
Anyone ever seen this before? I had SSH open and also had port 80 forwarded to my mac mini running Apache, but this looks to have either exploited SSH (I had it on port 22) or there's some other exploit method it used.
I attached all the files I gathered up (including the file that might be a virus) as a ZIP so someone with more knowledge can investigate further. My main concern is that this might be a "man in the middle" type of attack that works to steal passwords/information. Any help would be greatly appreciated.
dd-wrt-hacked.zip
Description:
The kb91021753.exe is most likely a virus so DONT open it unless you are investigating this dd-wrt hack.
I have a few questions to get an idea what may have caused this:
Did you download this build from dd-wrt site?
Did you password protect webmanagement, did you use ssh password or key etc?
Did you enable remote login through http?
Are you running any optware scripts/apps?
Did you record /var/log/messages to see login attemtps?
Have you used a strong ssh password. _________________ KONG PB's: http://www.desipro.de/ddwrt/
KONG Info: http://tips.desipro.de/
Scanned the executable file with 37 different virus scanners, only one of them reported it as a malware.
Result = Adware/EShoper.v
Which one of the 37 found it? I may need to change the Anti Virus software I use . Thanks for running all those scans. Neither of my Anti Virus programs thought it was a threat, but it just seemed like it had to be.
Did you password protect webmanagement?
I have web management disabled from the WAN, only internal access.
did you use ssh password or key etc?
I had an SSH password set. Maybe a shared key would be better?
Did you enable remote login through http?
nope, only SSH with username and password.
Are you running any optware scripts/apps?
nope, only forwarding a few ports. Port 80 for web and port 51413 for Transmission
Did you record /var/log/messages to see login attemtps?
No, but I'll look through the WIKI and set that up from now on.
Have you used a strong ssh password?
It was at least 8 characters with a mix of letters/numbers, so it's possible it could have been brute forced over time. I changed the user from "root" when I set it back up so that it will not be possible to log in as root.
But you have set a password for the webmanagement interface?
I ask this because it could be a dns rebinding issue, if you have no password set your browser could be fooled to send a post request to the router adding the wget command to your startup, which is possible if you don't have a password set for the webinterface. _________________ KONG PB's: http://www.desipro.de/ddwrt/
KONG Info: http://tips.desipro.de/
Joined: 08 Jun 2006 Posts: 247 Location: Prince Edward Island - Canada
Posted: Sun Mar 27, 2011 20:39 Post subject:
reece016 wrote:
<<snip>>
Did you use ssh password or key etc?
I had an SSH password set. Maybe a shared key would be better?
<<snip2>>
Have you used a strong ssh password?
It was at least 8 characters with a mix of letters/numbers, so it's possible it could have been brute forced over time. I changed the user from "root" when I set it back up so that it will not be possible to log in as root.
I've also wondered if authorized keys would be a better way to go..
Also, it doesn't matter if you change your login name, root will still work with ssh. It does add an extra bit of 'security' to the web login though.
Yes using authorized keys is much better first of all because you cannot use brute force methods anymore to try out passwords, the ssh server will close the connection at once if the client ask for password login.
Second advantage is, even if someone captures your password(keylogger, hardware usb keylogger, camera) he still cannot login until he also has your keyfile
This attack looks like an automated one, someone either scanned lots of machines to find an insecure dd-wrt box or he placed some code on a website which used dns rebinding technique to save this startup command.
If there was only ssh(no ftp etc.) accessable from outside it is likely the attack came from inside. For automated attacks it also helps to change ports e.g. ssh port to 2000 then an attacker would have to scan not just ips but every port on a target machine which takes way to long.
Compared to a regular linux distribution a router firmware is more secure since it does not include all features in the shipped apps e.g. lots of proftp bugs did not influence dd-wrts security since the vulnerable feature was not compile into dd-wrts proftp version. The other reason is because you don't directly work on your router which means local root exploits don't hit you.
Thus from the info he gave either there is an unknown security hole in dropbear or there were other exploitable services running on the router.
Or the attack come from the lan side and had access to the routers webinterface, either because he had no webinterface password set or was logged in to the webinterface at the time he viewed the attackers site. _________________ KONG PB's: http://www.desipro.de/ddwrt/
KONG Info: http://tips.desipro.de/
Damn it. I got the same message, and I actually ran the kb91021753.exe file. Now there is a C:\Windows\init.exe in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run and it comes back after reboot.
Please help me to get rid of the infected router first: How should I check the "startup" script?
I've power cycled the router, but my clean computer still get directed to http://update.windows.com/.kb910 page, and "ping" shows the update.windows.com is in [119.226.118.217].
After ssh into router, I ran
nvram get rc_startup
but got blank response.
All the files in /etc/config folder have Aug-8-2010 timestamp, that was when I installed this router (DD-WRT v24-sp2 (08/07/10) mini-usb-ftp)
So how should I check and restore the router to normal status, besides of uploading image? Would that help?
Joined: 04 Jan 2007 Posts: 11564 Location: Wherever the wind blows- North America
Posted: Sat Jul 02, 2011 18:01 Post subject:
If it were me...I'd use JTAG and erase nvram then the kernel...then start over with a fresh tftp load of the firmware. It isn't likely that it embedded itself in the CFE of the router....sounds like its firmware only.
redhawk _________________ The only stupid question....is the unasked one.
Joined: 24 Feb 2009 Posts: 2026 Location: Sol System > Earth > USA > Arkansas
Posted: Mon Jul 04, 2011 3:11 Post subject:
Ben0 wrote:
The other question is: How was it getting hacked and how to prevent that from happening again?
Looks like someone was scanning for open SSH ports. Once they found one, they brute forced it. Thank goodness I have a key for mine (and a non-standard port).
Thank you reece016 and Ben0 for reporting the problem. I am hoping people will look at this issue and do more to protect their router. _________________ E3000 22200M KongVPN K26
WRT600n v1.1 refirb mega 18767 BS K24 NEWD2 [not used]
WRT54G v2 16214 BS K24 [access point]
Try Dropbox for syncing files - get 2.5gb online for free by signing up.
Read! Peacock thread
*PLEASE* upgrade PAST v24SP1 or no support.