August 2, 2026·10 min read Guide
A hacked site being restored: from a wrecked page, through rotating keys and cleanup, to a secured version

Your website was hacked: what to do in the first 24 hours

If you have opened this page, chances are you do not have much time to read. Below is the order of play: what to do right now, what to do in an hour, and what can wait until tomorrow. The classic mistake of the first few minutes is to start deleting things. Let us look at why that usually does more harm than good, and what to do instead.

First, make sure it really is a hack

Not every site failure is a hack. But some signs almost always mean exactly that:

Any one sign can have another explanation: a drop in rankings can come from an algorithm change, a 500 error from a botched plugin update. But two or more signs together mean a hack — so work through the steps below in order.

The first hours, step by step

Step 1. Take a copy — before you start cleaning

The strongest urge in the first hour is to wipe everything suspicious and restore from a backup. That is exactly what most often leads to a second hack a week later. Along with the malicious files you destroy the only evidence of how the attacker got in. You will not close the hole, and he will come back the same way.

So the first thing is an archive: the site files, a database dump and, most important of all, the web server logs (these are text files where the server records every request to the site — usually access.log and error.log). Logs are rotated on a schedule, often within days, and there is no way to recover them afterwards. Download the archive to your own computer instead of leaving it on the same server.

Step 2. Close the site to visitors

While the site is infected, every visitor is at risk and search engines keep recording new malicious pages. Turn on maintenance mode or serve a stub page with a 503 status code — that way search engines understand this is temporary and will not drop your pages from the index. There is no need to delete the site entirely or to change DNS.

Step 3. Cut off access first, change passwords second

The order here is critical, and it is almost always broken. If you simply change the administrator password, the attacker will not even notice: he stopped using the login form long ago. He has a web shell on your server — a small file that lets him run commands straight from a browser, with no password at all. Or an active session in the admin panel. Or a server access key you never thought of as a password.

So the sequence is:

  1. End all active sessions. Most CMSs and hosting panels have a “log out on all devices” button. Without it, changing the password does not throw out someone who is already inside.
  2. Revoke access keys: SSH keys on the server, FTP and SFTP credentials, API tokens, integration and payment service keys, passwords for mailboxes on the domain.
  3. Change the passwords — the hosting panel, every CMS administrator, the database, mail, the domain registrar. Every password new and unique: if the same password was in use in three places, all three are compromised.
  4. Change the passwords from a clean computer. If the leak came from an infected machine, the new passwords will travel to the same place the same minute.

Step 4. Audit the accounts

Open the CMS user list and delete everyone you do not recognise — especially anyone with administrator rights. While you are there, check the things people usually forget: forwarding rules on the domain’s mailboxes (a popular way to quietly receive password reset emails), the list of SSH keys on the server, connected third-party apps and webhooks, and the access you granted to contractors.

If the site has access to your account at the domain registrar or at a payment provider, change the passwords there too. The domain and payment processing are more valuable assets than the site itself, and recovering a stolen domain is a long and miserable business.

Step 5. Look at when the files were modified

This is the fastest way to gauge the scale. Sort the site files by modification date — in the file manager of your hosting panel that takes a single click. The files changed on the suspicious day are your map of the infection. As a bonus you get an approximate time of the break-in, and with it the stretch of the logs you need.

Pay attention to .php files in directories where they have no business being: in the uploads folder, among the images, in the cache. A legitimate site does not execute code from the folder with the product photos.

How to find the entry point

Until you know how they got in, cleaning is pointless. There are four places worth looking.

The web server logs. Take the day your modified files are dated and find the requests to them. The typical picture: several dozen requests from one address within a minute (that is brute forcing), then a single successful POST request to the login page or to a file you are hearing about for the first time. If you are not ready to read the log yourself, this is exactly the fragment to hand to a specialist.

An outdated CMS, plugins and themes. The most common cause. Vulnerabilities in popular plugins are published constantly, and ready-made exploitation tools appear alongside them; automated scripts sweep the internet and try them one after another, without picking a victim. Look at what has gone longest without an update, and especially at what was disabled but not deleted: a disabled plugin still sits on disk, and its files are reachable by direct URL.

A stolen password. There may have been no break-in of the site at all: the FTP or panel password was lifted from a developer’s computer. Many FTP clients store saved passwords in near-plaintext, and malware grabs them first thing. The tell-tale sign is that the login succeeded straight away, with no brute forcing at all, from an ordinary end-user address. In that case run an antivirus scan on every machine used to access the site, including the computers of your contractors.

Neighbours on the hosting account. On cheap shared hosting, sites are sometimes laid out in such a way that an infection crawls from one to another. If you have several sites on one account, check them all at once.

If you still cannot find the entry point, there is a workable fallback: deploy the CMS from scratch, move over only the content (texts, images, the product and order database) and install the plugins you need by hand from official sources. You must not carry the old theme and plugin files over wholesale — the shell usually moves with them.

What to do before you put the site back online

The moment when everything looks cured is the most dangerous one. The site works, the panic has passed, and it feels as though you can take the stub page down. Before you do, close whatever let the hack happen.

A separate word about restoring from a backup. It helps you get the content back, but it does not solve the problem: the copy may have been taken after the infection, and the vulnerability in the old plugin is certainly still in it. Restoring is the “bring the content back” step, not the “cure it” step.

How to clear the “dangerous site” warning

The warning in the browser and in search results will not disappear on its own — you have to ask for a review. Do it after the cleanup: if the check finds malicious code again, you will wait longer for the next review.

A review is not instant — allow several days. While it is running, keep the site working and clean: malicious code reappearing during the review throws you back to the start.

If customer data may have been affected

This is the part small business owners skip most often — and it comes with legal consequences. If the site has enquiry forms, customer accounts, order checkout or a subscriber list, you process personal data and by law you are a data operator (Russia’s Federal Law No. 152-FZ “On Personal Data”).

In an incident where personal data may have been copied or altered by outsiders, the law requires you to notify Roskomnadzor — the Russian regulator that oversees personal data. The deadlines are short: the first notification comes almost immediately after discovery, the second, based on your internal investigation, a few days later. The wording currently in force puts them at roughly 24 and 72 hours, but before you file, be sure to check the current wording of the law and the notification form on the Roskomnadzor website — the requirements have changed and are still being refined. If you are unsure whether the incident counts as a breach, that is a question to put to a lawyer the same day, not a week later.

Separately from the formal obligation there is the human side. If passwords that customers might also use in other services passed through your site, it is more honest to tell them yourself and suggest they change the password. Customers forgive a hack far more easily than they forgive silence about it.

What not to do

In short

  1. Take a copy of the files, the database and the logs — before any cleaning.
  2. Close the site behind a stub page with a 503 status code.
  3. Kill the sessions and the keys, then change the passwords — from a clean computer.
  4. Review the administrators, the mail forwarding rules and the access granted to contractors.
  5. Find the entry point using the logs and the file modification dates.
  6. Update, delete what you do not need, turn on two-factor authentication, set up off-server backups.
  7. Request a review in Yandex.Webmaster and in Search Console.
  8. If personal data may have been affected, check the procedure and the deadlines for notification.

So that it does not happen again

Let us be honest up front: ShieldSafe does not cure hacked sites — we do not remove malicious code and we do not hunt for shells in your files. We do the other half of the job: we look at the site from the outside, the way an attacker does, and show you what can be used to get in — outdated components with known vulnerabilities, exposed service files, reachable admin panels. That is what you need to close after the cleanup, so you never have to go through all of this again.

Check your site