My Website Is Hacked, What Should I Do? A Step-by-Step Recovery Plan

By the Cehpoint teamPublished 6 min read

Short answer: If your website is hacked, first preserve evidence by taking a full copy of files, database and logs, then take the site offline if it harms visitors and change every password from a clean device. Report the incident to CERT-In within six hours where the 2022 directions apply, find the entry point, clean or redeploy, and request a Google review.

It usually starts with a phone call. A customer says your website is showing a betting page, or Chrome shows a red "Dangerous site" warning, or Google search results list your pages with Japanese text and pharmacy spam. Panic is natural. What you do in the first hour decides whether this is a two-day clean-up or a month of lost enquiries.

This is a step-by-step recovery plan for business websites, both WordPress and custom-built, including when the incident must be reported to CERT-In.

First hour: how do you contain a hacked website?

  1. Do not delete anything yet. The modified files and logs are evidence of how the attacker got in. Deleting them can mean you clean up and get hacked again the same way.
  2. Take a full snapshot of the current (infected) site: files, database and server logs. Store it offline. Note the date and time you first noticed the problem.
  3. Put the site into maintenance mode or take it offline if it is serving malware or phishing pages to visitors. Protecting customers comes first.
  4. Change every password from a clean device: hosting control panel, FTP/SFTP, database, CMS admin accounts, domain registrar, DNS provider and any email accounts linked to the site. Enable two-factor authentication wherever possible.
  5. Check your domain and DNS to confirm nobody has changed nameservers or records. A DNS hijack looks like a hacked site but needs a different fix.
  6. Inform your hosting provider. They may have server-side logs and can tell you whether other sites on the same server are affected.

Do you have to report a hacked website to CERT-In?

In many cases, yes. CERT-In's directions of 28 April 2022, issued under Section 70B(6) of the IT Act, require service providers, intermediaries, data centres, body corporates and government organisations to report listed cyber incidents to CERT-In within six hours of noticing them or being told about them. The list in Annexure I explicitly includes "defacement of website or intrusion into a website and unauthorised changes such as inserting malicious code, links to external websites", along with unauthorised access, malicious code attacks, data breach and data leak.

Reports can be sent to incident@cert-in.org.in; CERT-In's website has the current reporting formats. The same directions require ICT system logs to be kept securely for a rolling 180 days within India, and to be provided to CERT-In when reporting or on request. This is one more reason not to wipe the server before taking a copy.

If customer personal data was exposed, for example through a hacked contact-form database or customer accounts, obligations under India's data protection framework may also apply. Get legal advice early.

How do you find out how the attacker got in?

Cleaning without finding the entry point is the most common reason websites get re-hacked within weeks. Typical entry points:

Entry pointWhere to look
Outdated or nulled (pirated) WordPress plugin or themePlugin versions, files modified around the incident date
Weak or reused admin passwordLogin logs, new admin users you did not create
Stolen FTP or hosting credentialsHosting access logs, FTP logs
Vulnerable custom code (file upload, SQL injection)Web server logs for unusual requests to upload or search endpoints
Another compromised site on the same shared accountOther folders on the same hosting account

Look at the web server access logs around the earliest modified file. Unusual POST requests to an upload script or a plugin file usually point straight to the vulnerability.

How do you clean a hacked WordPress site?

  • Restore from a known clean backup taken before the compromise, if you have one and know the compromise date. Then patch the hole before going live.
  • Without a clean backup: reinstall WordPress core, and every plugin and theme, from official sources. Never reuse the existing copies.
  • Remove plugins and themes you do not use. Never use nulled premium plugins; they are a frequent source of malware.
  • Inspect the uploads folder for PHP files (there should normally be none), and the database for injected scripts, spam links and unknown admin users.
  • Check .htaccess, wp-config.php and scheduled tasks (cron) for malicious redirects or code that reinstalls the malware.

How do you clean a custom-built site?

  • Compare the live files with your source code repository. Anything that differs or does not exist in the repository is suspect.
  • Redeploy from the repository onto a fresh server or container where possible, rather than cleaning the infected one.
  • Fix the vulnerable code, rotate all secrets (API keys, database passwords, tokens) and review the database for injected content.
  • If you do not have the source code in a repository you control, this incident is a strong reason to fix that.

How do you get off Google's blacklist?

If Google has flagged your site, the Security Issues report in Google Search Console will show the issue type (hacked content, malware, social engineering) and sample URLs.

  1. Verify the site in Search Console if you have not already.
  2. Fix the issue across the whole site. Google says partial fixes will not restore visibility.
  3. Check key pages with a tool like cURL to confirm the clean version is served, and make sure Googlebot is not blocked.
  4. Click "Request Review" and explain exactly what you found, what you removed and how you closed the vulnerability.

Timelines vary by issue. Google's guidance says reviews for sites hacked with spam can take up to several weeks, malware reviews a few days, and phishing reviews about a day. If the site is found clean, browser and search warnings are removed within 72 hours. Do not request a review until you are sure; premature requests can slow future reviews.

What should you tell customers?

If visitors may have been shown malware or phishing pages, or if customer data may have been exposed, say so plainly. A short notice on the site and an email to affected customers should explain what happened, when, what you have done, and what they should do, for example change a password or ignore emails asking for payment to a new bank account. Silence tends to do more damage to trust than the incident itself, and a clear notice also reduces the chance of follow-on fraud using your name.

How do you stop it happening again?

  • Keep the CMS, plugins, themes and server software updated, with automatic security updates where safe.
  • Two-factor authentication on every admin, hosting and registrar account.
  • A web application firewall in front of the site.
  • Daily off-site backups, with restores tested.
  • File-change monitoring and uptime monitoring, so you hear about the next problem before customers do.
  • A periodic security test. A VAPT assessment finds the holes before attackers do.

How Cehpoint can help

We can contain and clean hacked websites, find the entry point, help with Google review requests and harden the site afterwards. Our website and app maintenance plan covers ongoing updates, backups and monitoring. If the incident involves fraud, data theft or a dispute where evidence matters, our cyber-crime investigation and digital forensics team handles evidence properly.

Frequently asked questions

Is it mandatory to report a hacked website to CERT-In?

CERT-In's directions of 28 April 2022 require service providers, intermediaries, data centres, body corporates and government organisations to report listed incidents within six hours of noticing them. The list includes website defacement, intrusion into a website and unauthorised changes such as inserted malicious code or links. Reports go to incident@cert-in.org.in. Check with a lawyer if you are unsure whether you are covered.

How long does Google take to remove the hacked site warning?

It depends on the issue. Google's guidance says reviews for sites hacked with spam can take up to several weeks, malware reviews a few days and phishing reviews about a day. If the review finds the site clean, warnings are removed within 72 hours. Fix the whole site before requesting a review, because premature requests slow things down.

Why does my website keep getting hacked again?

Usually because the clean-up removed the visible malware but not the entry point or the backdoor. Typical causes are an outdated or pirated plugin, a stolen hosting or FTP password, a hidden admin user, or a malicious scheduled task that reinstalls the code. Find how the attacker got in using logs, then close that hole.

Should I just restore my website from backup?

Restoring a backup taken before the compromise is often the fastest route, but only after you know when the compromise started and have fixed the vulnerability. Otherwise you may restore infected files, or restore a clean site that is hacked again the same way. Keep a copy of the infected site for investigation first.

Need help with this?

Tell us what you are dealing with. We reply with a plain plan, and where it makes sense, a working demo before you commit.