Linux – Real experience of being hacked on linux

hackinglinuxSecurity

I would like to hear real stories, how your linux box/server was hacked and what you do not to fall in to the same hole again.

Best Answer

About 2 years ago one of my co-located web servers was hacked. I tracked down the vulnerability to be in a php script I was running, an old version of PHPBB. The hacker basically used a hole to place a script on my server and execute it, which gave him full access to the server.

Luckily, he didn't do any damage, he simply installed a new website to be served off my box.

I was going through the logs one day, as I had seen my bandwidth usage skyrocket, and I found that he had installed a spoofed copy of another website on my server. Essentially it was an easy misspelling of an online store for watches, and I believe he was selling watches, collecting money, and obviously never sending anyone anything.

After I discovered this, I made a copy of everything he did - logs, scripts, the entire website, and archived it as well as sent it to my hosting provider.

I cleaned up his tracks, and began to secure my server.

As a result, I learned a lot about Linux security, and did several things:

  • Tightened up my SSH security including running it on a non-standard port.
  • chrooted apache
  • Installed and configured apache mod_security (which is amazing)
  • Started running some log monitoring/intrusion detection scripts
  • Killed any processes running on ports which I was not actively using

As a result, I have not been hacked since, and whenever anyone tries, I am alerted.

Some of the easiest ways your server can be hacked, if it is a standard web/email server are through common script vulnerabilities. You also should take extra steps if you are running an email server to ensure you are not an open relay of any kind, the spammers will find you and suddenly all email coming from your server will get blacklisted.