First Steps After Finding a Hacked Website
The first job is to stop more people seeing the damage. Everything else can wait a few minutes for that.
Take the site offline
A hacked site may be handing out spam pages or malware to everyone who visits. Google's advice is to take it offline so it no longer serves content to users.1
There's a side benefit. With the site offline, you can work with less interference from the hacker.1
How you do it depends on your setup. You can stop the web server, or point your site's DNS entries at a plain page on a different server. DNS is the address book that tells browsers where your site lives. That plain page should answer with a 503 status code, which tells browsers and search engines the site is down for now.1
Two common shortcuts don't work.1
- Returning an error code from the infected site itself isn't enough, because harmful content can still go out with it.
- A robots.txt block is also insufficient. It only blocks search engine crawlers, and ordinary visitors can still get in.
If you're not sure how to do any of this, ask your host. Google says contacting your hoster is helpful, and the host may be able to set up the 503 response from outside your infected folders.1
Tell your host
Your host is the company that runs the server your site sits on. Tell them the site has been compromised. They can check that their other customers weren't affected, and they may be able to help recover your site.2
Copy it before you change it
It sounds odd to back up an infected site. But Google's clean-up guide says to make backups even though the site is still infected, and to label them "infected". That gives you something to go back to if a fix goes wrong.3
Don't put an infected copy anywhere it can be served to visitors.
Lock the doors
Look at every user account on the site. If you find ones you didn't create, write down the names, then delete them. Change the passwords for all site users and accounts, including FTP, database, system administrator and CMS logins.1 A CMS is the content management system, such as the dashboard you log in to when editing pages.
Changing passwords and access after a hack lists what else to change.
Be careful how you look
Don't browse to infected pages to see what's wrong. Malware often spreads through browser weaknesses, so opening an infected page in a browser may damage your computer.4
Think about who else needs to know
If customer details may have been taken, think about your business, regulatory or legal duties before you start cleaning or deleting files.3 Privacy law differs from country to country. In Australia the official source is the OAIC, and your own lawyer can say what applies to you.
Australia's cyber agency also asks owners to report cybercrimes, incidents and vulnerabilities, which helps other businesses.5
The full order of work is in a hacked website clean-up checklist.
Where the facts come from
- Quarantine your site, web.dev (Google)
- Build a support team, web.dev (Google)
- Clean and maintain your site, web.dev (Google)
- Hacked with malware, web.dev (Google)
- Secure your website, Australian Signals Directorate (cyber.gov.au)