162 points · by mcgin · 16y ago · 67 comments
We only realized the machine was compromised because the interloper decided to pick two user accounts at random and delete them (another brilliant move).
Upon investigation I found that a keylogger had been installed in order to discover the root password. I inspected the output of the keylogger to trace the attacker's steps. Similar to the SSH scan in the article, the attacker had logged into his own FTP server to download various scripts and crackers. Well, the keylogger had logged his FTP password as well (whoops). Naturally I logged in and deleted absolutely everything in sight. :-P
...and you probably completely screwed over some hapless soul who was a victim of the same guy who cracked you. Do you think these guys put their IP address and FTP password out there for anyone to collect as evidence? Most likely, he hacked into an FTP server and hosted his malicious files there along with everything else that was already hosted there. Congratulations on breaking the law and ruining someone's day.
I also thought of more subtle and clever ways to exact revenge, but decided I was too busy to pursue any of them.
Also: Do you think these guys put their IP address and FTP password out there for anyone to collect as evidence?
Yes, I do. You're giving the script kiddies far too much credit.
Law enforcement has bigger issues. In a world where HBO can send a letter to my roommate from an IP in 10 days, and the police investigating a robbery have to wait 9 months for the same thing. You did the right thing.
I would have played a longer con game instead of nuking some random ftp server, he probably just set up another one.
That's an interesting attitude. Do you often find yourself having to "deal with" benign-but-ignorant FTP admins? Keep in mind that many people running FTP sites are not technical by trade, and you're using a rather wide brush stroke to paint a bad picture of many perfectly reasonable people.
Besides, judging by the recent submission of the decompiled code from RTM's worm from 1988 (http://news.ycombinator.com/item?id=1916186), hackers are a bit more sophisticated than you imply.
1. As far as I can tell, this specific attack is meant to target MIPS-based OpenWRT/DD-WRT devices, like the Linksys WRT series.
2. lsof and all that crap isn't available by default. So, use 'ps' and 'netstat -a', and 'ls -la /var/tmp' to poke around your router.
3. Go into the web admin interface and disable sshd on the WAN interface, if it isn't already (it's off by default). In DD-WRT, go to Administration->Management-> and ensure "SSH management" is disabled.
For this case specifically, if you're running openwrt you could try 'ps aux|grep syslgd' and see if you find anything. Then use 'lsof -p PID#' to see what files it's using. Or use 'lsof -i' to see what software has open connections. This can be very telling. Maybe 'netstat -anp| and looks for syslogd connecting out to the internet.
You should really follow basic security best practices and disable sshd on the outside interfaces, firewall unknown address, and switch sshd to a different port (security through obscurity will prevent the mass drive by port scanning).
Big ups for this -- since moving SSH to port 8022 I get zero bruteforce attacks. Even blacklisting tools like fail2ban can't get that kind of result. Of course it can't be the only defense, but I've always configured my SSH daemons to be key login only (no passwords). Moving SSH just cuts down on the CPU cycles burned at rejecting drone scans.
Every time I come across posts like this I consider maybe setting up a honeypot but I'm not sure what I'd do with the results other than look over them every few months for my own amusement. Are there any honeypots that can automatically forward information about the attacks to a central location?
I think if you can go without enabling remote access to a router, then you should. This will protect the router itself from direct login attacks from the outside, but if somebody compromises a machine on your LAN, you're boned. If you can't, and you have security concerns, you need to establish metrics of verifying whether or not the router is behaving the same way it was when it came out of the box and (presumably) was not compromised. Like I mentioned, software/firmware checksums are a possibility (these could be hard, though...getting a router to dump its internals out probably isn't a feasible solution for everything), but YMMV depending on what you do and what you need your router to do. My biggest guess at the tell-tale sign of a compromised router is that it just starts slowing down.
Obviously, just like moving SSH off of 22, this isn't a real defense, but it'll make it that much harder.
Definitely wise to prevent remote login from outside your LAN though. Also you can always run an IDS like Snort on your router; a proper IDS is probably the cleanest solution to this problem.
A botnet found one of my computers. Most likely through IRC. They have been trying relentlessly to get my computer added.
They have no chance of getting in - using public key authentication - but it still takes quite a toll on my network speed.
That said, I have a file containing about 366 IPs belonging to this botnet, as well as a half-meg file containing nmap scans of all these IPs. What should I do with it?
If they're all static IP addresses, try to block everything on port 22 except for your static IPs.
If it's dynamic you should have a pool address block, you can add the block in but there's a risk that if your block is in an ISPs home user pool that the botnet could infect people in your block.
If you can't use upstream filtering then I'd suggest you configure a firewall to do the same thing, either in hardware (preferable) or software.
I access my servers from a shared (Windows) computer. I trust the other users enough not to install keyloggers, but not enough to put the private keys on the computer.
From some experimentation with putty, I can't find a reasonable workflow that lets me save the server configs, but prompts for the private key every time I log in, so I can load them (from a USB key for eg).
The best thing I've come up with is using long random, machine generated passwords with a password manager.
Any better ideas?
I actually found him on the IRC network, and he tried to get me to pay him to tell me how he got in :)
Wonder if he followed-up with the hosting service by reporting the address as being used in an attack. It would be interesting to turn the tables and listen in on some of his traffic going to that address.
Oh, and please don't come with a snooty attitude, it's not pleasant to work with.
Put you in my address book in case I ever develop for a UK-audience site.
edit: I stand corrected..
When I see things like this it makes me think that if standard paths weren't used, then it would it at least make things a little more interesting for the hacker. (They'd have to find a location first.)
find / -maxdepth 3 -perm -7 -type d -print
and tweak as needed. # time find / -maxdepth 3 -perm -7 -type d -print
/tmp
/var/tmp
real 0m0.034s
user 0m0.005s
sys 0m0.028s
This was run on a pretty anemic VPS. Might have to up the depth to 4 if it doesn't return anything, but IMO that's pretty unlikely.I'm perfectly aware that this could be "extremely difficult" or "not feasible" in many situations, but it wouldn't be so hard to control if you made the device and designed the OS for it (linux-based routers, etc.). I'm just tired of people giving up and laying things out like a holiday dinner because it's "too difficult". Good security requires sacrifice of work and time.
Anything that can be obfuscated programatically (while still remaining usable) can be rediscovered programatically. This accomplishes nothing.