What should I do after being hacked

August 14, 2013 4.5k views
I noticed my test Rails app calling some strange routes " Started GET "/w00tw00t.at.blackhats.romanian.anti-sec:)". and also running php my admin scripts even though I never installed it. Also in the logs, there's a record of connections from strange ip addresses (such as ) that google results reveal to be associated with suspicious behaviour
5 Answers
How long did it take you to build your server to its current state? Hopefully you have a snapshot; so you can destroy the current droplet and spin up a new one. Situations like these also lend themselves to utilizing a configuration-management tool, like Puppet. Then, you could destroy this droplet, while having the piece of mind that you can spin up a new droplet rather easily & pick up right where you left off (b/f being hacked).

In the mean time, make sure you've set up your firewall, e.g. How to Setup a Firewall with UFW on an Ubuntu and Debian Cloud Server.
by Shaun Lewis
Learn how to setup a firewall with UFW on an Ubuntu / Debian cloud server.
I recommend disabling nginx/unicorn and killing all processes that are related to your rails app until you find the infected files.

As Pablo said, if you have a snapshot/backup of your droplet you can restore it from there.

those idiots scan the whole internet, I see that GET request every day at work.

Just because you see a GET or POST to your webserver does not mean you have been hacked.

If you have people actually connecting via ssh to your server (or whatever other management tools/ports) you have enabled and successfully logging in then be concerned or you seeing files in your web server that you did not put there (apache flaws, php exploits aka web server hacked etc)

You saying you are running php my admin even though you did not install it worries me though... you sure it didnt come with your droplet? Can you see who has connected to your server? Who is logged on from what IP?

If you have no clue kill the box and walk away slowly :)
Is this a GET request *from* your droplet or *to* your droplet?
Before destroying your droplet, it is very IMPORTANT to locate the security hole, and how they are gained access and hacked your server. Installing new droplet wont protect you from future hacks. If you can't - hire someone, but even then they might be covered they trails, if so you can use the image of the server (if you have) like a honey pot and wait for them to hack it again. But just re install droplets is not a good option.
Have another answer? Share your knowledge.