---
title: "My Website Got Hacked: First Steps Every Site Owner Should Take"  
description: "Website hacked? A calm, step-by-step response plan for the first hour, first day and first week: contain the damage, preserve evidence, find the entry"  
author: "Kaushik Mukherjee"  
published: 2026-11-22  
canonical: https://www.mindstick.com/blog/307145/my-website-got-hacked-first-steps-every-site-owner-should-take  
category: "cybersecurity"  
tags: ["website hacked what to do", "cybersecurity", "Application Security", "step by step tutorial", "for developers"]  
reading_time: 8 minutes  

---

# My Website Got Hacked: First Steps Every Site Owner Should Take

Maybe a customer called to say your homepage now advertises online casinos. Maybe Chrome shows a red “Dangerous site” warning. Maybe your hosting company suspended the account for sending spam, or you found admin users you never created.

However you found out, the next few hours matter. The natural reaction is to start deleting suspicious files immediately. Resist it for a moment. Acting fast is good. Acting in the right **order** is better.

This guide is split into three time frames: the first hour, the first day and the first week.

## The first hour: contain, don’t clean

### 1. Confirm what you’re seeing

Check the site from a different device and network, ideally a phone on mobile data. Some infections only show malicious content to visitors coming from Google, or only on mobile, while the owner sees a normal site. Note exactly what you saw, with URLs and screenshots.

### 2. Take the site offline, or put up a maintenance page

If the site is serving malware, phishing pages or redirects, every minute online harms your visitors and your reputation with search engines. Options include:

- a maintenance page served at the web server level (in IIS, an `app_offline.htm` file for ASP.NET Core apps)
- stopping the site in IIS or your hosting panel
- restricting access to your own IP address while you investigate

### 3. Preserve evidence before changing anything

Before you delete or restore anything, take copies of:

- the **entire web root**, including uploads
- a **database export**
- **web server access logs** and error logs (IIS logs usually live under `C:\inetpub\logs\LogFiles`)
- your control panel’s login history and FTP or SSH logs, if available

Store these copies **off the server**. Logs tell you how the attacker got in. Without them, you risk cleaning the site only to be re-hacked the same way next week.

### 4. Change passwords, from a clean device

Assume every credential connected to the site is known to the attacker. Change them from a computer you trust, not one that may itself be infected:

- hosting or server control panel
- server login (RDP, SSH) and FTP or SFTP accounts
- the CMS or application admin accounts
- database users (then update the connection string)
- domain registrar and DNS provider
- email accounts used to reset any of the above

Turn on **two-factor authentication** everywhere it’s offered, especially for the registrar and hosting account. An attacker who controls your domain can redirect everything.

## The first day: understand what happened

### 5. Work out the scope

Ask these questions:

- **Is customer data involved?** Check whether databases holding names, emails, phone numbers, addresses or payment details were accessed or exported. Look for large or unusual queries in the logs.
- **Is it just this site?** Shared hosting accounts often hold several sites. If one is compromised, check all of them.
- **Is the server itself compromised**, or only the application? New Windows user accounts, unfamiliar scheduled tasks or services, and unknown processes making outbound connections suggest the attacker has gone deeper than the website.

### 6. Find the entry point

Common ways in, roughly from most to least likely for small business sites:

1. **Outdated CMS core, plugins or themes** with known vulnerabilities
2. **Weak or reused passwords**, often an admin account with no 2FA
3. **File upload forms** that accept scripts disguised as images
4. **SQL injection** in custom code (see our guide on preventing SQL injection)
5. **Leaked credentials**: FTP passwords in old config backups, or keys committed to a public Git repository
6. **A compromised developer or admin PC**

In the access logs, look at the time the first malicious file appeared. Then look for `POST` requests just before it, requests to unusual file names, and repeated login attempts from the same IP address.

Search for recently modified files. In PowerShell:

```
Get-ChildItem -Path "C:\inetpub\wwwroot\yoursite" -Recurse -File |
  Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-14) } |
  Sort-Object LastWriteTime -Descending |
  Select-Object LastWriteTime, FullName
```

Be aware that attackers sometimes fake file timestamps. Also look for script files in places that should only hold images or documents, such as `.php`, `.aspx` or `.ashx` files inside an uploads folder.

### 7. Report it, if the rules apply to you

In India, **CERT-In’s directions require service providers, intermediaries, data centres, body corporates and government organisations to report specified types of cyber security incidents within 6 hours** of noticing them. The listed types include website defacement, compromise of websites and unauthorised access to IT systems and data. Reports go to CERT-In; check the current reporting format and contact details on CERT-In’s website.

If personal data has been breached, the **Digital Personal Data Protection (DPDP) Act** obligations also matter. Under the DPDP Rules, the breach notification duties to affected individuals and the Data Protection Board are part of the provisions that take effect in **May 2027**. If you process personal data for clients, your contracts may also require you to tell them quickly.

If payment card data might be involved, contact your payment gateway or acquiring bank straight away.

*This is general guidance, not legal advice. Check your specific obligations with a qualified professional.*

## The first week: clean up and recover

### 8. Restore from a known-good backup, or rebuild

The most reliable cleanup is **not** hunting for every bad file. It’s replacing everything with known-good copies:

- **Code:** redeploy from your Git repository or a fresh download of the CMS and plugins, rather than editing infected files in place.
- **Uploads:** copy them back only after checking that they contain no scripts.
- **Database:** restore from a backup taken *before* the compromise, if you can identify when it started. Otherwise, inspect it for injected content, such as script tags in posts, spam links, and unknown admin users.
- **Server:** if the operating system itself was compromised, rebuild the server. Malware with administrator access can hide well enough that “cleaning” a server is a gamble.

### 9. Close the hole you found

Restoring without fixing the entry point just resets the clock. Patch the CMS and plugins, remove plugins you don’t use, fix the vulnerable code, block script execution in upload folders, and remove old backup files and test pages from the web root.

### 10. Get search engine warnings removed

If Google flagged your site, open **Google Search Console** and go to **Security & Manual Actions → Security issues**. It lists the problems Google found, often with example URLs. When the site is clean, use **Request Review** and describe what you fixed.

Also check for spam pages the attacker may have created. Search `site:yourdomain.com` combined with words like “casino” or “viagra”, or look for unfamiliar URLs in the Pages report. Make sure those URLs now return a 404 or 410.

If your domain or server IP ended up on email blocklists because it sent spam, request delisting once the source is fixed.

### 11. Tell the people who need to know

If customer data was exposed, tell affected people **clearly and promptly**: what happened, what data was involved, what you’ve done, and what they should do (for example, change a reused password or be alert to phishing). An honest message almost always does less reputational damage than customers finding out from someone else.

## Making sure it doesn’t happen again

- **Automatic updates** for the CMS, plugins and server, or at least a fixed weekly patch routine
- **2FA** on every admin, hosting, registrar and email account
- **Off-site, versioned backups** you have actually restored at least once
- **A web application firewall** (from your host, a CDN, or a service such as Cloudflare)
- **File integrity monitoring** or uptime monitoring that alerts you when pages change unexpectedly
- **Least privilege:** the website’s app pool or database account shouldn’t have rights it doesn’t need
- **HTTPS everywhere**, with automatic certificate renewal
- **A written incident plan**, even one page, so the next incident starts at step 1 rather than with panic

## The short version

1. Contain: take the site offline.
2. Preserve: copy files, database and logs off the server.
3. Secure: change every password from a clean device, and turn on 2FA.
4. Investigate: find what was accessed and how they got in.
5. Report: to CERT-In within 6 hours where required, and to affected people and the Data Protection Board where personal data is involved.
6. Rebuild: from clean code and backups, and fix the entry point.
7. Recover: request a Google review and delisting.
8. Harden: so the next attempt fails.

Getting hacked is stressful, but it’s recoverable. Working through it in order, rather than all at once, is what turns a bad week into a lesson instead of a recurring problem.

---

Original Source: https://www.mindstick.com/blog/307145/my-website-got-hacked-first-steps-every-site-owner-should-take

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
