Monday, April 07, 2008Written by Nathan Johns, Search Quality Team All right, you got hacked. It happens to many webmasters, even despite the hard work you devote to prevent this type of thing from happening. Prevention tips include keeping your site updated with the latest software and patches, creating an account with Google Webmaster Tools to see what's being indexed, keeping tabs on your log files to make sure nothing fishy's going on, etc. (There's more information in the Quick Security Checklist we posted last year.) Remember that you're not alone—hacked sites are becoming increasingly common. Getting hacked can result in your site being infected with badware (more specifically malware, one type of badware). Take a look at StopBadware 's recently released report on Trends in Badware 2007 for a comprehensive analysis of threats and trends over the previous year. Check out this post on the Google Online Security Blog which highlights the increasing number of search results containing a URL labeled as harmful. For even more in-depth technical reports on the analysis of web-based malware, see The Ghost in the Browser (pdf) and this technical report (pdf) on drive-by downloads. Read these, and you'll have a much better understanding of the scope of the problem. They also include some real examples for different types of malware. The first step in any case should be to contact your hosting provider, if you have one. Often times they can handle most of the technical heavy lifting for you. Lots of webmasters use shared hosting, which can make it difficult to do some of the things listed below. Certain tips labeled with an asterisk (*) are cases in which webmasters using shared hosting will most likely require assistance from their hosting provider. In the case that you do have full control over your server, we recommend covering these four bases: Getting your site off-line
- Take your site off-line temporarily, at least until you know you've fixed things.*
- If you can't take it off-line, return a 503 status code to prevent it from being crawled.
- In the Webmaster Tools, use the URL removal tool to remove any hacked pages or URLs from search results that may have been added. This will prevent the hacked pages from being served to users.
- It's a good idea to figure out exactly what the hacker was after.
- Were they looking for sensitive information?
- Did they want to gain control of your site for other purposes?
- Look for any modified or uploaded files on your web server.
- Check your server logs for any suspicious activity, such as failed login attempts, command history (especially as root), unknown user accounts, etc.
- Determine the scope of the problem—do you have other sites that may be affected?
- The absolute best thing to do here is a complete reinstall of the OS from a trusted source. It's the only way to be completely sure you've removed everything the hacker may have done.*
- After a fresh re-installation, use the latest backup you have to restore your site. Don't forget to make sure the backup is clean and doesn't have any hacked content.*
- Patch any software packages to the latest version. This includes things such as weblog platforms, content management systems, or any other type of third-party software installed.
- Change your passwords -
- Get your system back online.
- If you're a Webmaster Tools user, sign in to your account
- If your site was flagged as having malware, request a review to determine whether your site is clean
- If you used the URL removal tool on URLs which you do want in the index, request that Webmaster Tools re-include your content by revoking the removal.
- Keep an eye on things, as the hacker may try to return.
- If your site's been flagged by Google as serving malware, we'll alert you when you visit Webmaster Tools.
- Don't forget about the Google Webmaster Help Group ; it's full of extremely knowledgeable users, and Googlers as well. For a nice, on-topic example, check out this thread. There's also a Stop Badware group.
- Matt Cutts recently posted Three tips to protect your WordPress installation on his blog, and there are lots of great comments below the post as well.