Insecure/Hacked server: lessons learned
2 comments
Nice write-up. Out of interest, why were you running a Windows server?
I have some screencap/pdf processing applications that are win only so I decided to go with windows. I have thought about getting separate/non public boxes for the win only apps that I need but funds are tight so this may need to wait for another day.
Ah fair enough, makes sense :-)
Some details:
Does anyone have any idea what all this data in/out could have been?
most wtf moment: installing wireshark and watching my password fly past in cleartext
This was a dev box I kept for testing. In no particular order here's a list of stupid mistakes I made:
I knew these and other things needed to be eventually set up, but you know how it is... there're always a million other things to do :|
My guess is that the box was comporomised via apache. Running MSSecurity essentials yeilded no less that ~50 trojans. Not sure why so many. Maybe was compromised by multiple attackers?
I was running a few sites for friends/acquantances from this machine as a favor, so my next thought was: how do I not inconvenience these people with down time?
Purely by luck I had made a full backup up of /web just 2 days prior so a restore was going to be painless. If not for this, recovering anything from the machine would have been a very painful process since any traffic from Rackspace-->My Home Machine would need to be tightly managed.
So the test box was toast and the image needed to be destroyed (a true case of: 'aghhh burn it with fire!')
This was finally the motivation I needed to secure a machine, especially since I'm just weeks away from lauching my first web app.
These tips mostly apply for *nix/win
For windows: I was surprised how easy it is to grant more permissions for a user than intended. Double check the permissions from the 'Effective Permissions Tab' in the folder security tab. To double check and for your own peace of mind: log into the machine as Apache/MySQL and see what you can access/do.
Wow this turned out longer than intended. Feel free to add any other hints/tips.
Resources: http://robsnotebook.com/xampp-security-hardening gives a nice general purpose checklist for securing xampp (applies to any apache/mysql install)